rust/tests/ui/consts/miri_unleashed
bors 59bb9505bc Auto merge of #103208 - cjgillot:match-fake-read, r=oli-obk,RalfJung
Allow partially moved values in match

This PR attempts to unify the behaviour between `let _ = PLACE`, `let _: TY = PLACE;` and `match PLACE { _ => {} }`.
The logical conclusion is that the `match` version should not check for uninitialised places nor check that borrows are still live.

The `match PLACE {}` case is handled by keeping a `FakeRead` in the unreachable fallback case to verify that `PLACE` has a legal value.

Schematically, `match PLACE { arms }` in surface rust becomes in MIR:
```rust
PlaceMention(PLACE)
match PLACE {
  // Decision tree for the explicit arms
  arms,
  // An extra fallback arm
  _ => {
    FakeRead(ForMatchedPlace, PLACE);
    unreachable
  }
}
```

`match *borrow { _ => {} }` continues to check that `*borrow` is live, but does not read the value.
`match *borrow {}` both checks that `*borrow` is live, and fake-reads the value.

Continuation of ~https://github.com/rust-lang/rust/pull/102256~ ~https://github.com/rust-lang/rust/pull/104844~

Fixes https://github.com/rust-lang/rust/issues/99180 https://github.com/rust-lang/rust/issues/53114
2023-10-27 18:51:43 +00:00
..
auxiliary
abi-mismatch.rs
abi-mismatch.stderr
assoc_const_2.rs
assoc_const_2.stderr Add a note to duplicate diagnostics 2023-10-05 01:04:41 +00:00
assoc_const.rs
assoc_const.stderr Add a note to duplicate diagnostics 2023-10-05 01:04:41 +00:00
box.rs
box.stderr
const_refers_to_static_cross_crate.32bit.stderr Use PlaceMention for match scrutinees. 2023-10-24 15:30:17 +00:00
const_refers_to_static_cross_crate.64bit.stderr Use PlaceMention for match scrutinees. 2023-10-24 15:30:17 +00:00
const_refers_to_static_cross_crate.rs
const_refers_to_static.32bit.stderr Stop trying to preserve pretty-printing. 2023-10-16 19:15:28 +00:00
const_refers_to_static.64bit.stderr Stop trying to preserve pretty-printing. 2023-10-16 19:15:28 +00:00
const_refers_to_static.rs
drop.rs
drop.stderr
feature-gate-unleash_the_miri_inside_of_you.rs
feature-gate-unleash_the_miri_inside_of_you.stderr
inline_asm.rs
inline_asm.stderr
mutable_references_err.32bit.stderr Stop trying to preserve pretty-printing. 2023-10-16 19:15:28 +00:00
mutable_references_err.64bit.stderr Stop trying to preserve pretty-printing. 2023-10-16 19:15:28 +00:00
mutable_references_err.rs
mutable_references.rs
mutable_references.stderr
mutating_global.rs
mutating_global.stderr
non_const_fn.rs
non_const_fn.stderr
ptr_arith.rs Remove unused feature from a miri test 2023-10-26 00:46:56 +00:00
ptr_arith.stderr Remove unused feature from a miri test 2023-10-26 00:46:56 +00:00
raw_mutable_const.rs
raw_mutable_const.stderr
slice_eq.rs
tls.rs
tls.stderr