]> git.lizzy.rs Git - rust.git/commitdiff
after a Ref, only acquire the Deref'd destination
authorRalf Jung <post@ralfj.de>
Tue, 25 Jul 2017 02:19:39 +0000 (19:19 -0700)
committerRalf Jung <post@ralfj.de>
Sun, 30 Jul 2017 08:11:59 +0000 (01:11 -0700)
src/librustc_mir/transform/add_validation.rs

index d91db41d20d33191a6a60d64013d479619b13044..4edcab738c37562c592386d0cdbc4e1e835bf2bc 100644 (file)
@@ -184,6 +184,10 @@ fn run_pass<'a, 'tcx>(&self,
                     _ => continue,
                 };
                 // So this is a ref, and we got all the data we wanted.
+                // Do an acquire of the result -- but only what it points to, so add a Deref
+                // projection.
+                let dest_lval = Projection { base: dest_lval, elem: ProjectionElem::Deref };
+                let dest_lval = Lvalue::Projection(Box::new(dest_lval));
                 let acquire_stmt = Statement {
                     source_info: block_data.statements[i].source_info,
                     kind: StatementKind::Validate(ValidationOp::Acquire,