]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/middle/mem_categorization.rs
librustc: Don't allow use after move of implicitly coerced object. Fixes #11481.
[rust.git] / src / librustc / middle / mem_categorization.rs
index c50d23ff592e8b0b014c69066679b03982153555..8cf39d14763b395ec07cfee1f77693cc52d02777 100644 (file)
@@ -345,9 +345,12 @@ pub fn cat_expr(&self, expr: &ast::Expr) -> cmt {
                 match **adjustment {
                     ty::AutoObject(..) => {
                         // Implicity casts a concrete object to trait object
-                        // Result is an rvalue
+                        // so just patch up the type
                         let expr_ty = ty::expr_ty_adjusted(self.tcx, expr);
-                        self.cat_rvalue_node(expr, expr_ty)
+                        @cmt_ {
+                            ty: expr_ty,
+                            ..*self.cat_expr_unadjusted(expr)
+                        }
                     }
 
                     ty::AutoAddEnv(..) => {