about summary refs log tree commit diff
path: root/compiler/rustc_mir/src/const_eval
diff options
context:
space:
mode:
authorSmitty <me@smitop.com>2021-06-18 17:33:33 -0400
committerSmitty <me@smitop.com>2021-06-29 19:08:29 -0400
commit3e735a52febb098e1b541e89a6653adbcb134760 (patch)
tree3b501e152a99e8753b39b13932e6cdead59e9b73 /compiler/rustc_mir/src/const_eval
parent43b55cf8935e4f96b143efff1a43bb30c3d55545 (diff)
Unwrap allocated Location at creation
Diffstat (limited to 'compiler/rustc_mir/src/const_eval')
-rw-r--r--compiler/rustc_mir/src/const_eval/mod.rs6
1 files changed, 1 insertions, 5 deletions
diff --git a/compiler/rustc_mir/src/const_eval/mod.rs b/compiler/rustc_mir/src/const_eval/mod.rs
index 8e379f9eb28..6a514e9f62f 100644
--- a/compiler/rustc_mir/src/const_eval/mod.rs
+++ b/compiler/rustc_mir/src/const_eval/mod.rs
@@ -31,11 +31,7 @@ pub(crate) fn const_caller_location(
     trace!("const_caller_location: {}:{}:{}", file, line, col);
     let mut ecx = mk_eval_cx(tcx, DUMMY_SP, ty::ParamEnv::reveal_all(), false);
 
-    // This can fail if rustc runs out of memory right here. Trying to emit an error would be
-    // pointless, since that would require allocating more memory than a Location.
-    let loc_place = ecx
-        .alloc_caller_location(file, line, col)
-        .expect("not enough memory to allocate location?");
+    let loc_place = ecx.alloc_caller_location(file, line, col);
     if intern_const_alloc_recursive(&mut ecx, InternKind::Constant, &loc_place).is_err() {
         bug!("intern_const_alloc_recursive should not error in this case")
     }