Rollup merge of #129199 - RalfJung:writes_through_immutable_pointer, r=compiler-errors

make writes_through_immutable_pointer a hard error

This turns the lint added in https://github.com/rust-lang/rust/pull/118324 into a hard error. This has been reported in cargo's future-compat reports since Rust 1.76 (released in February). Given that const_mut_refs is still unstable, it should be impossible to even hit this error on stable: we did accidentally stabilize some functions that can cause this error, but that got reverted in https://github.com/rust-lang/rust/pull/117905. Still, let's do a crater run just to be sure.

Given that this should only affect unstable code, I don't think it needs an FCP, but let's Cc ``@rust-lang/lang`` anyway -- any objection to making this unambiguous UB into a hard error during const-eval? This can be viewed as part of https://github.com/rust-lang/rust/pull/129195 which is already nominated for discussion.
This commit is contained in:
Matthias Krüger 2024-08-24 22:14:12 +02:00 committed by GitHub
commit 05b8bcc662
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 23 additions and 102 deletions

View file

@ -572,7 +572,8 @@ fn register_builtins(store: &mut LintStore) {
"byte_slice_in_packed_struct_with_derive",
"converted into hard error, see issue #107457 \
<https://github.com/rust-lang/rust/issues/107457> for more information",
)
);
store.register_removed("writes_through_immutable_pointer", "converted into hard error");
}
fn register_internals(store: &mut LintStore) {