Do not unnecessarily eval consts in codegen

This commit is contained in:
Michael Goulet 2024-09-20 20:38:11 -04:00
parent da889684c8
commit 914193c8f4
8 changed files with 30 additions and 19 deletions

View file

@ -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)) };