Skip to content

Commit 98dc76a

Browse files
committed
Always report alignment failures in future incompat summaries
1 parent d9d92ed commit 98dc76a

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

compiler/rustc_lint_defs/src/builtin.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,7 @@ declare_lint! {
10521052
"raw pointers must be aligned before dereferencing",
10531053
@future_incompatible = FutureIncompatibleInfo {
10541054
reference: "issue #68585 <https://github.com/rust-lang/rust/issues/104616>",
1055+
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
10551056
};
10561057
}
10571058

src/test/ui/consts/const-eval/ub-ref-ptr.32bit.stderr

+18
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,21 @@ LL | ptr.read();
168168
error: aborting due to 15 previous errors
169169

170170
For more information about this error, try `rustc --explain E0080`.
171+
Future incompatibility report: Future breakage diagnostic:
172+
error: accessing memory with alignment 1, but alignment 4 is required
173+
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
174+
|
175+
= note: inside `std::ptr::read::<u32>`
176+
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
177+
|
178+
= note: inside `ptr::const_ptr::<impl *const u32>::read`
179+
|
180+
::: $DIR/ub-ref-ptr.rs:65:5
181+
|
182+
LL | ptr.read();
183+
| ---------- inside `UNALIGNED_READ`
184+
|
185+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
186+
= note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/104616>
187+
= note: `#[deny(invalid_alignment)]` on by default
188+

src/test/ui/consts/const-eval/ub-ref-ptr.64bit.stderr

+18
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,21 @@ LL | ptr.read();
168168
error: aborting due to 15 previous errors
169169

170170
For more information about this error, try `rustc --explain E0080`.
171+
Future incompatibility report: Future breakage diagnostic:
172+
error: accessing memory with alignment 1, but alignment 4 is required
173+
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
174+
|
175+
= note: inside `std::ptr::read::<u32>`
176+
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
177+
|
178+
= note: inside `ptr::const_ptr::<impl *const u32>::read`
179+
|
180+
::: $DIR/ub-ref-ptr.rs:65:5
181+
|
182+
LL | ptr.read();
183+
| ---------- inside `UNALIGNED_READ`
184+
|
185+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
186+
= note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/104616>
187+
= note: `#[deny(invalid_alignment)]` on by default
188+

0 commit comments

Comments
 (0)