Skip to content

Commit 3bc42d5

Browse files
committed
distinguish by-val passes of pointer and non-pointer things
1 parent 64c7897 commit 3bc42d5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/rustc/middle/borrowck/gather_loans.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,24 @@ fn req_loans_in_expr(ex: @ast::expr,
8484
// the pointer to be borrowed as immutable even if it
8585
// is mutable in the caller's frame, thus effectively
8686
// passing the buck onto us to enforce this)
87+
//
88+
// FIXME---this handling is not really adequate. For
89+
// example, if there is a type like, {f: [int]}, we
90+
// will ignore it, but we ought to be requiring it to
91+
// be immutable (whereas something like {f:int} would
92+
// be fine).
8793

8894
alt opt_deref_kind(arg_ty.ty) {
8995
some(deref_ptr(region_ptr)) |
9096
some(deref_ptr(unsafe_ptr)) {
9197
/* region pointers are (by induction) guaranteed */
9298
/* unsafe pointers are the user's problem */
9399
}
100+
some(deref_comp(_)) |
94101
none {
95102
/* not a pointer, no worries */
96103
}
97-
some(_) {
104+
some(deref_ptr(_)) {
98105
let arg_cmt = self.bccx.cat_borrow_of_expr(arg);
99106
self.guarantee_valid(arg_cmt, m_const, scope_r);
100107
}

0 commit comments

Comments
 (0)