From 9abc7f0a1cb5086fa6d9a38841258859a16cbdfe Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Wed, 5 Sep 2012 19:19:37 -0700 Subject: [PATCH] (For legacy code:) In liveness, require that by-move arguments are rvalues --- src/rustc/middle/liveness.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/rustc/middle/liveness.rs b/src/rustc/middle/liveness.rs index 5ead871a661..a0a422bc027 100644 --- a/src/rustc/middle/liveness.rs +++ b/src/rustc/middle/liveness.rs @@ -1461,7 +1461,15 @@ fn check_expr(expr: @expr, &&self: @Liveness, vt: vt<@Liveness>) { match ty::resolved_mode(self.tcx, arg_ty.mode) { by_val | by_copy | by_ref => {} by_move => { - self.check_move_from_expr(*arg_expr, vt); + if ty::expr_is_lval(self.tcx, self.ir.method_map, + *arg_expr) { + // Probably a bad error message (what's an rvalue?) + // but I can't think of anything better + self.tcx.sess.span_err(arg_expr.span, + #fmt("Move mode argument must be an rvalue: try \ + (move %s) instead", expr_to_str(*arg_expr, + self.tcx.sess.intr()))); + } } } }