diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-08-31 14:46:14 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-31 14:46:14 +0200 |
| commit | 830b1deaeec6bff881c4a969ee1e5ddb1c156a0a (patch) | |
| tree | 3786c5de1594f23563dbc6e1755aacdd5b351140 /compiler/rustc_const_eval/src/interpret | |
| parent | 5a61a7b904e1ca1b1335ae6076267a6dde64e1b9 (diff) | |
| parent | d0aedfbb900309bb633b3ba04bf008183cfdd9a7 (diff) | |
Rollup merge of #129812 - RalfJung:box-custom-alloc, r=compiler-errors
interpret, codegen: tweak some comments and checks regarding Box with custom allocator Cc https://github.com/rust-lang/rust/issues/95453
Diffstat (limited to 'compiler/rustc_const_eval/src/interpret')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/place.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/place.rs b/compiler/rustc_const_eval/src/interpret/place.rs index 2afdd02c880..ede6a51c712 100644 --- a/compiler/rustc_const_eval/src/interpret/place.rs +++ b/compiler/rustc_const_eval/src/interpret/place.rs @@ -438,14 +438,16 @@ where &self, src: &impl Readable<'tcx, M::Provenance>, ) -> InterpResult<'tcx, MPlaceTy<'tcx, M::Provenance>> { + if src.layout().ty.is_box() { + // Derefer should have removed all Box derefs. + // Some `Box` are not immediates (if they have a custom allocator) + // so the code below would fail. + bug!("dereferencing {}", src.layout().ty); + } + let val = self.read_immediate(src)?; trace!("deref to {} on {:?}", val.layout.ty, *val); - if val.layout.ty.is_box() { - // Derefer should have removed all Box derefs - bug!("dereferencing {}", val.layout.ty); - } - let mplace = self.ref_to_mplace(&val)?; Ok(mplace) } |
