about summary refs log tree commit diff
path: root/tests/rustdoc/cross-crate-info/write-docs-somewhere-else/e.rs
diff options
context:
space:
mode:
authorJacob Pratt <jacob@jhpratt.dev>2025-08-22 22:00:46 -0400
committerGitHub <noreply@github.com>2025-08-22 22:00:46 -0400
commitbc4a6431eb579bd1332c36b27e3e176c9b1d17c3 (patch)
tree8834cb682a6155c7b228ef5780e13a88dca21d0d /tests/rustdoc/cross-crate-info/write-docs-somewhere-else/e.rs
parent467c89cd0b1c579edc247808c35941677918d29d (diff)
parent9aa8cfaf2f80a25711b115a3f09682ecbb0a06ab (diff)
downloadrust-bc4a6431eb579bd1332c36b27e3e176c9b1d17c3.tar.gz
rust-bc4a6431eb579bd1332c36b27e3e176c9b1d17c3.zip
Rollup merge of #142185 - saethlin:refprop-moves, r=cjgillot
Convert moves of references to copies in ReferencePropagation

This is a fix for https://github.com/rust-lang/rust/issues/141101.

The root cause of this miscompile is that the SsaLocals analysis that MIR transforms use is supposed to detect locals that are only written to once, in their single assignment. But that analysis is subtly wrong; it does not consider `Operand::Move` to be a write even though the meaning ascribed to `Operand::Move` (at least as a function parameter) by Miri is that the callee may have done arbitrary writes to the caller's Local that the Operand wraps (because `Move` is pass-by-pointer). So Miri conwiders `Operand::Move` to be a write but both the MIR visitor system considers it a read, and so does SsaLocals.

I have tried fixing this by changing the `PlaceContext` that is ascribed to an `Operand::Move` to a `MutatingUseContext` but that seems to have borrow checker implications, and changing SsaLocals seems to have wide-ranging regressions in MIR optimizations.

So instead of doing those, this PR adds a new kludge to ReferencePropagation, which follows the same line of thinking as the kludge in CopyProp that solves this same problem inside that pass: https://github.com/rust-lang/rust/blob/a5584a8fe16037dc01782064fa41424a6dbe9987/compiler/rustc_mir_transform/src/copy_prop.rs#L65-L98
Diffstat (limited to 'tests/rustdoc/cross-crate-info/write-docs-somewhere-else/e.rs')
0 files changed, 0 insertions, 0 deletions