about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJorge Aparicio <japaricious@gmail.com>2014-12-15 16:18:17 -0500
committerJorge Aparicio <japaricious@gmail.com>2014-12-18 14:56:00 -0500
commit5caebb23cd3b2c4c8519cc94759a7bc0a377f959 (patch)
tree9b913513fb35f3f4f43da6af57fedd58e2097dfc
parentb98c3bd4d2e03f801435165fe8fa75cbf59c0582 (diff)
downloadrust-5caebb23cd3b2c4c8519cc94759a7bc0a377f959.tar.gz
rust-5caebb23cd3b2c4c8519cc94759a7bc0a377f959.zip
Tell regionck that user unops are by value
-rw-r--r--src/librustc_typeck/check/regionck.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/librustc_typeck/check/regionck.rs b/src/librustc_typeck/check/regionck.rs
index 2ec7e2c3883..bfa3c384da7 100644
--- a/src/librustc_typeck/check/regionck.rs
+++ b/src/librustc_typeck/check/regionck.rs
@@ -682,10 +682,12 @@ fn visit_expr(rcx: &mut Rcx, expr: &ast::Expr) {
             visit::walk_expr(rcx, expr);
         }
 
-        ast::ExprUnary(_, ref lhs) if has_method_map => {
+        ast::ExprUnary(op, ref lhs) if has_method_map => {
+            let implicitly_ref_args = !ast_util::is_by_value_unop(op);
+
             // As above.
             constrain_call(rcx, expr, Some(&**lhs),
-                           None::<ast::Expr>.iter(), true);
+                           None::<ast::Expr>.iter(), implicitly_ref_args);
 
             visit::walk_expr(rcx, expr);
         }