about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2017-07-24 19:19:39 -0700
committerRalf Jung <post@ralfj.de>2017-07-30 01:11:59 -0700
commit04f962adc39c2632da8f712b2cd38eb6109ae5a1 (patch)
tree2a097c9def60e593080182372b98f7e7cbeb622a
parentb6816b2b56f5e1044f100e0ab7da0d9540d8f9cf (diff)
after a Ref, only acquire the Deref'd destination
-rw-r--r--src/librustc_mir/transform/add_validation.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/librustc_mir/transform/add_validation.rs b/src/librustc_mir/transform/add_validation.rs
index d91db41d20d..4edcab738c3 100644
--- a/src/librustc_mir/transform/add_validation.rs
+++ b/src/librustc_mir/transform/add_validation.rs
@@ -184,6 +184,10 @@ impl MirPass for AddValidation {
                     _ => 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,