about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-10-25 02:27:09 +0000
committerbors <bors@rust-lang.org>2020-10-25 02:27:09 +0000
commit36a74944cbf7fd29da9ddfb13a0feb485d4ca934 (patch)
treea56dd1da976f80d31e824c64f9318e0a5d3869d7 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parent7c533c89b3d98a0154048c6a4e90252335253ac8 (diff)
parentd727f642b939305ed7a68e5f74875d4d52304ebf (diff)
downloadrust-36a74944cbf7fd29da9ddfb13a0feb485d4ca934.tar.gz
rust-36a74944cbf7fd29da9ddfb13a0feb485d4ca934.zip
Auto merge of #77526 - RalfJung:dont-promote-unions, r=lcnr
stop promoting union field accesses in 'const'

Turns out that promotion of union field accesses is the only difference between "promotion in `const`/`static` bodies" and "explicit promotion". So if we can remove this, we have finally achieved what I thought to already be the case -- that the bodies of `const`/`static` initializers behave the same as explicit promotion contexts.

The reason we do not want to promote union field accesses is that they can introduce UB, i.e., they can go wrong. We want to [minimize the ways promoteds can fail to evaluate](https://github.com/rust-lang/const-eval/issues/53). Also this change makes things more consistent overall, removing a special case that was added without much consideration (as far as I can tell).

Cc `@rust-lang/wg-const-eval`
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions