-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
343: Add test for issue 342 r=taiki-e a=taiki-e Add test for #342 Co-authored-by: Taiki Endo <[email protected]>
- Loading branch information
Showing
6 changed files
with
62 additions
and
13 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 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 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,15 @@ | ||
// https://github.com/taiki-e/pin-project/issues/342 | ||
|
||
#![allow(unaligned_references)] | ||
|
||
use auxiliary_macro::hidden_repr2; | ||
use pin_project::pin_project; | ||
|
||
#[pin_project] //~ ERROR reference to packed field is unaligned | ||
#[hidden_repr2] | ||
struct A { | ||
#[pin] | ||
f: u32, | ||
} | ||
|
||
fn main() {} |
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,16 @@ | ||
error: reference to packed field is unaligned | ||
--> tests/ui/pin_project/packed_sneaky-4.rs:8:1 | ||
| | ||
8 | #[pin_project] //~ ERROR reference to packed field is unaligned | ||
| ^^^^^^^^^^^^^^ | ||
| | ||
note: the lint level is defined here | ||
--> tests/ui/pin_project/packed_sneaky-4.rs:8:1 | ||
| | ||
8 | #[pin_project] //~ ERROR reference to packed field is unaligned | ||
| ^^^^^^^^^^^^^^ | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523> | ||
= note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) | ||
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) | ||
= note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) |