Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Feb 27, 2021
1 parent 2872f1e commit 91ee109
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/unaligned_references.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#[repr(packed)]
pub struct X {
pub inner: u16,
}

#[forbid(unaligned_references)]
fn _f(this: &X) {
let _ = &this.inner;
//~^ ERROR reference to packed field is unaligned
}

pin_project_lite::pin_project! {
//~^ WARN borrow of packed field is unsafe and requires unsafe function or block (error E0133)
#[repr(packed)]
pub struct Y {
pub inner: u16
}
}

0 comments on commit 91ee109

Please sign in to comment.