about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/common.rs
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2022-05-18 07:41:01 +0900
committerGitHub <noreply@github.com>2022-05-18 07:41:01 +0900
commit248890c32ec174596d520936110709deb879a10f (patch)
tree69b8eaa00bb5d5e5f65a275c054d543f2c815467 /compiler/rustc_codegen_llvm/src/common.rs
parentb8dd27079c93d71f9667edbe17d0037c32c299af (diff)
parent201750d035fd5e85f5b56745f781bfb9370973da (diff)
downloadrust-248890c32ec174596d520936110709deb879a10f.tar.gz
rust-248890c32ec174596d520936110709deb879a10f.zip
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`
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/common.rs')
0 files changed, 0 insertions, 0 deletions