From 3754572b0a6859c4ab2730c2ccaafa89217bfb04 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 1 Aug 2017 23:00:23 -0700 Subject: [PATCH] Release of an Undef local is fine, and a NOP --- src/librustc_mir/interpret/validation.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/librustc_mir/interpret/validation.rs b/src/librustc_mir/interpret/validation.rs index 4454e21b1aac..bc3affed836e 100644 --- a/src/librustc_mir/interpret/validation.rs +++ b/src/librustc_mir/interpret/validation.rs @@ -11,7 +11,7 @@ use super::{ EvalError, EvalResult, EvalErrorKind, EvalContext, DynamicLifetime, AccessKind, LockInfo, - Value, + PrimVal, Value, Lvalue, LvalueExtra, Machine, }; @@ -179,6 +179,7 @@ impl<'a, 'tcx, M: Machine<'tcx>> EvalContext<'a, 'tcx, M> { } } + // Release of an Undef local is fine, and a NOP. // HACK: For now, bail out if we hit a dead local during recovery (can happen because sometimes we have // StorageDead before EndRegion). // TODO: We should rather fix the MIR. @@ -186,7 +187,8 @@ impl<'a, 'tcx, M: Machine<'tcx>> EvalContext<'a, 'tcx, M> { Lvalue::Local { frame, local } => { let res = self.stack[frame].get_local(local); match (res, mode) { - (Err(EvalError{ kind: EvalErrorKind::DeadLocal, ..}), ValidationMode::Recover(_)) => { + (Err(EvalError{ kind: EvalErrorKind::DeadLocal, ..}), ValidationMode::Recover(_)) | + (Ok(Value::ByVal(PrimVal::Undef)), ValidationMode::Release) => { return Ok(()); } _ => {},