about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-09-20 20:38:11 -0400
committerMichael Goulet <michael@errs.io>2024-09-20 20:38:11 -0400
commit914193c8f40528fe82696e1054828de8c399882e (patch)
treeef48c9e20d30d11fa4580da23e6153be56dac6e3 /compiler/rustc_codegen_llvm/src
parentda889684c80508036ff036db8c159ffdcf27648a (diff)
downloadrust-914193c8f40528fe82696e1054828de8c399882e.tar.gz
rust-914193c8f40528fe82696e1054828de8c399882e.zip
Do not unnecessarily eval consts in codegen
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
-rw-r--r--compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
index 6c84a40defb..57e396415cc 100644
--- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
+++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
@@ -125,7 +125,9 @@ fn build_fixed_size_array_di_node<'ll, 'tcx>(
 
     let (size, align) = cx.size_and_align_of(array_type);
 
-    let upper_bound = len.eval_target_usize(cx.tcx, ty::ParamEnv::reveal_all()) as c_longlong;
+    let upper_bound = len
+        .try_to_target_usize(cx.tcx)
+        .expect("expected monomorphic const in codegen") as c_longlong;
 
     let subrange =
         unsafe { Some(llvm::LLVMRustDIBuilderGetOrCreateSubrange(DIB(cx), 0, upper_bound)) };