-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
46 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
src/test/ui/lint/packed_reference.rs → src/test/ui/lint/unaligned_references.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#![deny(packed_references)] | ||
#![deny(unaligned_references)] | ||
|
||
#[repr(packed)] | ||
pub struct Good { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
error: reference to packed field is unaligned | ||
--> $DIR/unaligned_references.rs:14:17 | ||
| | ||
LL | let _ = &good.data; | ||
| ^^^^^^^^^^ | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/unaligned_references.rs:1:9 | ||
| | ||
LL | #![deny(unaligned_references)] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
= note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) | ||
|
||
error: reference to packed field is unaligned | ||
--> $DIR/unaligned_references.rs:15:17 | ||
| | ||
LL | let _ = &good.data as *const _; | ||
| ^^^^^^^^^^ | ||
| | ||
= note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) | ||
|
||
error: reference to packed field is unaligned | ||
--> $DIR/unaligned_references.rs:16:27 | ||
| | ||
LL | let _: *const _ = &good.data; | ||
| ^^^^^^^^^^ | ||
| | ||
= note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) | ||
|
||
error: reference to packed field is unaligned | ||
--> $DIR/unaligned_references.rs:17:17 | ||
| | ||
LL | let _ = &good.data2[0]; | ||
| ^^^^^^^^^^^^^^ | ||
| | ||
= note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) | ||
|
||
error: aborting due to 4 previous errors | ||
|