Rollup merge of #95372 - RalfJung:unaligned_references, r=oli-obk
make unaligned_references lint deny-by-default This lint has been warn-by-default for a year now (since https://github.com/rust-lang/rust/pull/82525), so I think it is time to crank it up a bit. Code that triggers the lint causes UB (without `unsafe`) when executed, so we really don't want people to write code like this.
This commit is contained in:
commit
49a31cdc1d
17 changed files with 490 additions and 41 deletions
|
@ -27,7 +27,6 @@
|
|||
#![feature(thread_id_value)]
|
||||
#![feature(vec_into_raw_parts)]
|
||||
#![allow(rustc::default_hash_types)]
|
||||
#![deny(unaligned_references)]
|
||||
#![allow(rustc::potential_query_instability)]
|
||||
|
||||
#[macro_use]
|
||||
|
|
|
@ -1110,8 +1110,6 @@ declare_lint! {
|
|||
/// ### Example
|
||||
///
|
||||
/// ```rust,compile_fail
|
||||
/// #![deny(unaligned_references)]
|
||||
///
|
||||
/// #[repr(packed)]
|
||||
/// pub struct Foo {
|
||||
/// field1: u64,
|
||||
|
@ -1139,10 +1137,11 @@ declare_lint! {
|
|||
/// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
|
||||
/// [issue #82523]: https://github.com/rust-lang/rust/issues/82523
|
||||
pub UNALIGNED_REFERENCES,
|
||||
Warn,
|
||||
Deny,
|
||||
"detects unaligned references to fields of packed structs",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #82523 <https://github.com/rust-lang/rust/issues/82523>",
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
|
||||
};
|
||||
report_in_external_macro
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue