about summary refs log tree commit diff
path: root/src/librustc_mir/interpret
diff options
context:
space:
mode:
authorAlexander Regueiro <alexreg@me.com>2018-05-30 19:27:45 +0100
committerAlexander Regueiro <alexreg@me.com>2018-06-30 23:52:33 +0100
commita2cd95fd9ea3eb698dc9f8ae7dd29321e5345e96 (patch)
tree13d9ec9ad20c59041fdea36e0f46c95529c3bae5 /src/librustc_mir/interpret
parent349d53c2a90e7adc45b2c07bdb038cfb03669b37 (diff)
downloadrust-a2cd95fd9ea3eb698dc9f8ae7dd29321e5345e96.tar.gz
rust-a2cd95fd9ea3eb698dc9f8ae7dd29321e5345e96.zip
Fixed bug with miri const evaluation where allocation is recursively borrowed.
Diffstat (limited to 'src/librustc_mir/interpret')
-rw-r--r--src/librustc_mir/interpret/memory.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/librustc_mir/interpret/memory.rs b/src/librustc_mir/interpret/memory.rs
index daa30fb187c..8e1f24c3f01 100644
--- a/src/librustc_mir/interpret/memory.rs
+++ b/src/librustc_mir/interpret/memory.rs
@@ -305,7 +305,8 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
                 Some(alloc) => Ok(alloc),
                 None => {
                     // static alloc?
-                    match self.tcx.alloc_map.lock().get(id) {
+                    let alloc = self.tcx.alloc_map.lock().get(id);
+                    match alloc {
                         Some(AllocType::Memory(mem)) => Ok(mem),
                         Some(AllocType::Function(..)) => {
                             Err(EvalErrorKind::DerefFunctionPointer.into())