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 Move /src/test to /tests 2023-01-11 09:32:08 +00:00
abi-mismatch.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
abi-mismatch.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
assoc_const_2.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
assoc_const_2.stderr Add a note to duplicate diagnostics 2023-10-05 01:04:41 +00:00
assoc_const.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
assoc_const.stderr Add a note to duplicate diagnostics 2023-10-05 01:04:41 +00:00
box.rs Remove uses of box_syntax in rustc and tools 2023-03-12 13:19:46 +00:00
box.stderr Remove uses of box_syntax in rustc and tools 2023-03-12 13:19:46 +00:00
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 Perform match checking on THIR. 2023-04-03 15:59:21 +00:00
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 Move /src/test to /tests 2023-01-11 09:32:08 +00:00
drop.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
drop.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
feature-gate-unleash_the_miri_inside_of_you.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
feature-gate-unleash_the_miri_inside_of_you.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
inline_asm.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
inline_asm.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
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 Move /src/test to /tests 2023-01-11 09:32:08 +00:00
mutable_references.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
mutable_references.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
mutating_global.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
mutating_global.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
non_const_fn.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
non_const_fn.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
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 Use translatable diagnostics in rustc_const_eval 2023-06-01 14:45:18 +00:00
raw_mutable_const.stderr Use translatable diagnostics in rustc_const_eval 2023-06-01 14:45:18 +00:00
slice_eq.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
tls.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
tls.stderr Bless tests 2023-04-05 15:59:29 +00:00