rust/compiler
Yuki Okushi 248890c32e
Rollup merge of #97116 - RalfJung:ref-validity, r=oli-obk
interpret/validity: reject references to uninhabited types

According to https://doc.rust-lang.org/reference/behavior-considered-undefined.html, this is definitely UB. And we can check this without actually looking up anything in memory, we just need the reference value and its type, making this a great candidate for a validity invariant IMO and my favorite resolution of https://github.com/rust-lang/unsafe-code-guidelines/issues/77.

With this PR, Miri with `-Zmiri-check-number-validity` implements all my preferred options for what the validity invariants of our types could be. :)

CTFE has been doing recursive checking anyway, so this is backwards compatible but might change the error output. I will submit a PR with the new Miri tests soon.

r? `@oli-obk`
2022-05-18 07:41:01 +09:00
..
2022-05-16 20:15:06 -04:00
2022-05-16 22:23:32 -05:00
2022-05-16 20:15:06 -04:00
2022-05-17 06:48:03 -04:00
2022-05-13 18:27:40 -04:00