make unaligned_reference a hard error
This commit is contained in:
parent
f361413cbf
commit
dfc4a7b2d0
27 changed files with 170 additions and 686 deletions
|
@ -1,4 +1,3 @@
|
|||
// run-pass (note: this is spec-UB, but it works for now)
|
||||
#![allow(dead_code)]
|
||||
// ignore-emscripten weird assertion?
|
||||
|
||||
|
@ -20,15 +19,12 @@ struct Foo4C {
|
|||
baz: usize
|
||||
}
|
||||
|
||||
#[warn(unaligned_references)]
|
||||
pub fn main() {
|
||||
let foo = Foo1 { bar: 1, baz: 2 };
|
||||
let brw = &foo.baz; //~WARN reference to packed field is unaligned
|
||||
//~^ previously accepted
|
||||
let brw = &foo.baz; //~ERROR reference to packed field is unaligned
|
||||
assert_eq!(*brw, 2);
|
||||
|
||||
let foo = Foo2 { bar: 1, baz: 2 };
|
||||
let brw = &foo.baz; //~WARN reference to packed field is unaligned
|
||||
//~^ previously accepted
|
||||
let brw = &foo.baz; //~ERROR reference to packed field is unaligned
|
||||
assert_eq!(*brw, 2);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue