diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-09-21 07:22:49 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-21 07:22:49 +0200 |
| commit | ff6cd18a75619f438e971f1db3b1ec43e6659870 (patch) | |
| tree | 2d0e9933e16dff006c1ddc6600ac80aa74a74032 /compiler/rustc_codegen_llvm/src/debuginfo | |
| parent | 43366285f48a3e22ca48e5b4b6bce4632a751c4b (diff) | |
| parent | c0d1a1305d711912f40e325f2111e15fb0791eb1 (diff) | |
| download | rust-ff6cd18a75619f438e971f1db3b1ec43e6659870.tar.gz rust-ff6cd18a75619f438e971f1db3b1ec43e6659870.zip | |
Rollup merge of #130644 - compiler-errors:consts-in-codegen, r=BoxyUwU
Only expect valtree consts in codegen Turn a bunch of `Const::eval_*` calls into `Const::try_to_*` calls, which implicitly assert that we only have valtrees by the time we get to codegen. r? `@BoxyUwU`
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/debuginfo')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs | 4 |
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)) }; |
