summary refs log tree commit diff
path: root/src/rustc/middle
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2012-06-03 07:34:10 -0700
committerNiko Matsakis <niko@alum.mit.edu>2012-06-06 18:36:47 -0700
commit3bc42d5661d7e41885ef192bc2f4a5b8410a79f2 (patch)
tree4abbe4d0f1cc1f3e6058380c95d1f8f96bc464f8 /src/rustc/middle
parent64c78971876df254d346c237fa7173770610c066 (diff)
downloadrust-3bc42d5661d7e41885ef192bc2f4a5b8410a79f2.tar.gz
rust-3bc42d5661d7e41885ef192bc2f4a5b8410a79f2.zip
distinguish by-val passes of pointer and non-pointer things
Diffstat (limited to 'src/rustc/middle')
-rw-r--r--src/rustc/middle/borrowck/gather_loans.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/rustc/middle/borrowck/gather_loans.rs b/src/rustc/middle/borrowck/gather_loans.rs
index df16a50f8ff..373488e5547 100644
--- a/src/rustc/middle/borrowck/gather_loans.rs
+++ b/src/rustc/middle/borrowck/gather_loans.rs
@@ -84,6 +84,12 @@ fn req_loans_in_expr(ex: @ast::expr,
                 // the pointer to be borrowed as immutable even if it
                 // is mutable in the caller's frame, thus effectively
                 // passing the buck onto us to enforce this)
+                //
+                // FIXME---this handling is not really adequate.  For
+                // example, if there is a type like, {f: [int]}, we
+                // will ignore it, but we ought to be requiring it to
+                // be immutable (whereas something like {f:int} would
+                // be fine).
 
                 alt opt_deref_kind(arg_ty.ty) {
                   some(deref_ptr(region_ptr)) |
@@ -91,10 +97,11 @@ fn req_loans_in_expr(ex: @ast::expr,
                     /* region pointers are (by induction) guaranteed */
                     /* unsafe pointers are the user's problem */
                   }
+                  some(deref_comp(_)) |
                   none {
                     /* not a pointer, no worries */
                   }
-                  some(_) {
+                  some(deref_ptr(_)) {
                     let arg_cmt = self.bccx.cat_borrow_of_expr(arg);
                     self.guarantee_valid(arg_cmt, m_const, scope_r);
                   }