From 04f962adc39c2632da8f712b2cd38eb6109ae5a1 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 24 Jul 2017 19:19:39 -0700 Subject: [PATCH] after a Ref, only acquire the Deref'd destination --- src/librustc_mir/transform/add_validation.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/librustc_mir/transform/add_validation.rs b/src/librustc_mir/transform/add_validation.rs index d91db41d20d3..4edcab738c37 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,