about summary refs log tree commit diff
path: root/src/test/incremental/thinlto
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-05-26 22:11:22 +0200
committerGitHub <noreply@github.com>2020-05-26 22:11:22 +0200
commit6e6bd630e67e79d553e52eaca191555991eedd8f (patch)
treee6682f5f7a557158160f028de79f2a94c3b9c8d2 /src/test/incremental/thinlto
parentaeca4d6428c52cbf2c8d1f28657b0bdf92e4ea7c (diff)
parentd959a8f91d9945302f58a8f79613e75060c6b77d (diff)
downloadrust-6e6bd630e67e79d553e52eaca191555991eedd8f.tar.gz
rust-6e6bd630e67e79d553e52eaca191555991eedd8f.zip
Rollup merge of #72270 - RalfJung:lint-ref-to-packed, r=oli-obk
add a lint against references to packed fields

Creating a reference to an insufficiently aligned packed field is UB and should be disallowed, both inside and outside of `unsafe` blocks. However, currently there is no stable alternative (https://github.com/rust-lang/rust/issues/64490) so all we do right now is have a future incompatibility warning when doing this outside `unsafe` (https://github.com/rust-lang/rust/issues/46043).

This adds an allow-by-default lint. @retep998 suggested this can help early adopters avoid issues. It also means we can then do a crater run where this is deny-by-default as suggested by @joshtriplett.

I guess the main thing to bikeshed is the lint name. I am not particularly happy with "packed_references" as it sounds like the packed field has reference type. I chose this because it is similar to "safe_packed_borrows". What about "reference_to_packed" or "unaligned_reference" or so?
Diffstat (limited to 'src/test/incremental/thinlto')
0 files changed, 0 insertions, 0 deletions