diff options
| author | bors <bors@rust-lang.org> | 2024-08-31 16:43:26 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-08-31 16:43:26 +0000 |
| commit | d571ae851d93541bef826c3c48c1e9ad99da77d6 (patch) | |
| tree | 3786c5de1594f23563dbc6e1755aacdd5b351140 /compiler/rustc_const_eval/src | |
| parent | 9649706eada1b2c68cf6504356efb058f68ad739 (diff) | |
| parent | 830b1deaeec6bff881c4a969ee1e5ddb1c156a0a (diff) | |
| download | rust-d571ae851d93541bef826c3c48c1e9ad99da77d6.tar.gz rust-d571ae851d93541bef826c3c48c1e9ad99da77d6.zip | |
Auto merge of #129817 - matthiaskrgr:rollup-ll2ld5m, r=matthiaskrgr
Rollup of 12 pull requests Successful merges: - #129659 (const fn stability checking: also check declared language features) - #129711 (Expand NLL MIR dumps) - #129730 (f32 docs: define 'arithmetic' operations) - #129733 (Subtree update of `rust-analyzer`) - #129749 (llvm-wrapper: adapt for LLVM API changes) - #129757 (Add a test for trait solver overflow in MIR inliner cycle detection) - #129760 (Make the "detect-old-time" UI test more representative) - #129767 (Remove `#[macro_use] extern crate tracing`, round 4) - #129774 (Remove `#[macro_use] extern crate tracing` from rustdoc and rustfmt) - #129785 (Miri subtree update) - #129791 (mark joboet as on vacation) - #129812 (interpret, codegen: tweak some comments and checks regarding Box with custom allocator) Failed merges: - #129777 (Add `unreachable_pub`, round 4) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_const_eval/src')
| -rw-r--r-- | compiler/rustc_const_eval/src/check_consts/check.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/place.rs | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/compiler/rustc_const_eval/src/check_consts/check.rs b/compiler/rustc_const_eval/src/check_consts/check.rs index 6a086a3a7e5..7cfb101399d 100644 --- a/compiler/rustc_const_eval/src/check_consts/check.rs +++ b/compiler/rustc_const_eval/src/check_consts/check.rs @@ -868,9 +868,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> { // Calling an unstable function *always* requires that the corresponding gate // (or implied gate) be enabled, even if the function has // `#[rustc_allow_const_fn_unstable(the_gate)]`. - let gate_declared = |gate| { - tcx.features().declared_lib_features.iter().any(|&(sym, _)| sym == gate) - }; + let gate_declared = |gate| tcx.features().declared(gate); let feature_gate_declared = gate_declared(gate); let implied_gate_declared = implied_by.is_some_and(gate_declared); if !feature_gate_declared && !implied_gate_declared { 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) } |
