diff options
| author | bors <bors@rust-lang.org> | 2025-08-19 04:22:49 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-08-19 04:22:49 +0000 |
| commit | 8365fcb2b840c95eeb0bc377af8bd498fad22245 (patch) | |
| tree | 803b7bb87deb46b579af4ec13dc1f415d4ac4e73 /compiler/rustc_const_eval/src | |
| parent | b96868fa2ef174b0a5aeb3bf041b3a5b517f11f8 (diff) | |
| parent | 531ec858e9a1c69840f70d4f2a485c288f50fc11 (diff) | |
| download | rust-8365fcb2b840c95eeb0bc377af8bd498fad22245.tar.gz rust-8365fcb2b840c95eeb0bc377af8bd498fad22245.zip | |
Auto merge of #145589 - Zalathar:rollup-k97wtuq, r=Zalathar
Rollup of 19 pull requests
Successful merges:
- rust-lang/rust#140956 (`impl PartialEq<{str,String}> for {Path,PathBuf}`)
- rust-lang/rust#141744 (Stabilize `ip_from`)
- rust-lang/rust#142681 (Remove the `#[no_sanitize]` attribute in favor of `#[sanitize(xyz = "on|off")]`)
- rust-lang/rust#142871 (Trivial improve doc for transpose )
- rust-lang/rust#144252 (Do not copy .rmeta files into the sysroot of the build compiler during check of rustc/std)
- rust-lang/rust#144476 (rustdoc-search: search backend with partitioned suffix tree)
- rust-lang/rust#144567 (Fix RISC-V Test Failures in ./x test for Multiple Codegen Cases)
- rust-lang/rust#144804 (Don't warn on never to any `as` casts as unreachable)
- rust-lang/rust#144960 ([RTE-513] Ignore sleep_until test on SGX)
- rust-lang/rust#145013 (overhaul `&mut` suggestions in borrowck errors)
- rust-lang/rust#145041 (rework GAT borrowck limitation error)
- rust-lang/rust#145243 (take attr style into account in diagnostics)
- rust-lang/rust#145405 (cleanup: use run_in_tmpdir in run-make/rustdoc-scrape-examples-paths)
- rust-lang/rust#145432 (cg_llvm: Small cleanups to `owned_target_machine`)
- rust-lang/rust#145484 (Remove `LlvmArchiveBuilder` and supporting code/bindings)
- rust-lang/rust#145557 (Fix uplifting in `Assemble` step)
- rust-lang/rust#145563 (Remove the `From` derive macro from prelude)
- rust-lang/rust#145565 (Improve context of bootstrap errors in CI)
- rust-lang/rust#145584 (interpret: avoid forcing all integer newtypes into memory during clear_provenance)
Failed merges:
- rust-lang/rust#145359 (Fix bug where `rustdoc-js` tester would not pick the right `search.js` file if there is more than one)
- rust-lang/rust#145573 (Add an experimental unsafe(force_target_feature) attribute.)
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_const_eval/src')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/operand.rs | 10 | ||||
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/place.rs | 7 |
2 files changed, 17 insertions, 0 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/operand.rs b/compiler/rustc_const_eval/src/interpret/operand.rs index 53a440b646b..560b0e1ae4e 100644 --- a/compiler/rustc_const_eval/src/interpret/operand.rs +++ b/compiler/rustc_const_eval/src/interpret/operand.rs @@ -175,6 +175,16 @@ impl<Prov: Provenance> Immediate<Prov> { } interp_ok(()) } + + pub fn has_provenance(&self) -> bool { + match self { + Immediate::Scalar(scalar) => matches!(scalar, Scalar::Ptr { .. }), + Immediate::ScalarPair(s1, s2) => { + matches!(s1, Scalar::Ptr { .. }) || matches!(s2, Scalar::Ptr { .. }) + } + Immediate::Uninit => false, + } + } } // ScalarPair needs a type to interpret, so we often have an immediate and a type together diff --git a/compiler/rustc_const_eval/src/interpret/place.rs b/compiler/rustc_const_eval/src/interpret/place.rs index 3255ffa54aa..e7fe4c0b34f 100644 --- a/compiler/rustc_const_eval/src/interpret/place.rs +++ b/compiler/rustc_const_eval/src/interpret/place.rs @@ -759,6 +759,13 @@ where &mut self, dest: &impl Writeable<'tcx, M::Provenance>, ) -> InterpResult<'tcx> { + // If this is an efficiently represented local variable without provenance, skip the + // `as_mplace_or_mutable_local` that would otherwise force this local into memory. + if let Right(imm) = dest.to_op(self)?.as_mplace_or_imm() { + if !imm.has_provenance() { + return interp_ok(()); + } + } match self.as_mplace_or_mutable_local(&dest.to_place())? { Right((local_val, _local_layout, local)) => { local_val.clear_provenance()?; |
