about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-05-26 10:17:51 +0000
committerbors <bors@rust-lang.org>2017-05-26 10:17:51 +0000
commit2f278c57ff4a805941f1497f34b3ad20b6f8e13b (patch)
tree90848c8b6a5e27747289b2b20b21f7daaaf60bfe /src/rustllvm/RustWrapper.cpp
parent2db17c86e33ab89f8003960de08e3f1a3d23df8a (diff)
parentfa13cd3489c09d2de6ae4b2d0d455c1cf3db82fc (diff)
downloadrust-2f278c57ff4a805941f1497f34b3ad20b6f8e13b.tar.gz
rust-2f278c57ff4a805941f1497f34b3ad20b6f8e13b.zip
Auto merge of #42083 - petrochenkov:safeassign, r=nikomatsakis
Make assignments to `Copy` union fields safe

This is an accompanying PR to PR https://github.com/rust-lang/rust/pull/42068 stabilizing FFI unions.

This was first proposed in https://github.com/rust-lang/rust/issues/32836#issuecomment-281296416, see subsequent comments as well.
Assignments to `Copy` union fields do not read any data from the union and are [equivalent](https://github.com/rust-lang/rust/issues/32836#issuecomment-281660298) to whole union assignments, which are safe, so they should be safe as well. This removes a significant number of "false positive" unsafe blocks, in code dealing with FFI unions in particular.

It desirable to make this change now, together with stabilization of FFI unions, because now it affecfts only unstable code, but later it will cause warnings/errors caused by `unused_unsafe` lint in stable code.

cc #32836
r? @nikomatsakis
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions