about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorOliver Scherer <github35764891676564198441@oli-obk.de>2019-12-23 17:33:09 +0100
committerOliver Scherer <github35764891676564198441@oli-obk.de>2019-12-26 12:11:12 +0100
commit2e66f85111da32cc7789957097b7d10c3e314515 (patch)
tree1d0e9aabff11dbeaaba6bc356b08adf6c5de3d76 /src
parentb97abd0761d3949cd6e17ba0d31c3d8ea1c8f0fc (diff)
downloadrust-2e66f85111da32cc7789957097b7d10c3e314515.tar.gz
rust-2e66f85111da32cc7789957097b7d10c3e314515.zip
Bail out before running the query
Diffstat (limited to 'src')
-rw-r--r--src/librustc_mir/const_eval/machine.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/librustc_mir/const_eval/machine.rs b/src/librustc_mir/const_eval/machine.rs
index 115511fa70a..0cb654b30cc 100644
--- a/src/librustc_mir/const_eval/machine.rs
+++ b/src/librustc_mir/const_eval/machine.rs
@@ -40,15 +40,16 @@ impl<'mir, 'tcx> InterpCx<'mir, 'tcx, CompileTimeInterpreter<'mir, 'tcx>> {
             return Ok(false);
         }
 
-        let gid = GlobalId { instance, promoted: None };
-
-        let place = self.const_eval_raw(gid)?;
         let dest = match ret {
             Some((dest, _)) => dest,
             // Don't memoize diverging function calls.
             None => return Ok(false),
         };
 
+        let gid = GlobalId { instance, promoted: None };
+
+        let place = self.const_eval_raw(gid)?;
+
         self.copy_op(place.into(), dest)?;
 
         self.return_to_block(ret.map(|r| r.1))?;