Rollup merge of #39692 - oli-obk:patch-2, r=aturon
remove wrong packed struct test This UB was found by running the test under [Miri](https://github.com/solson/miri) which rejects these unsafe unaligned loads. 😄
This commit is contained in:
commit
92cf7aecb4
1 changed files with 0 additions and 12 deletions
|
@ -25,12 +25,6 @@ struct Baz<T: ?Sized> {
|
||||||
a: T
|
a: T
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(packed)]
|
|
||||||
struct Packed<T: ?Sized> {
|
|
||||||
a: u8,
|
|
||||||
b: T
|
|
||||||
}
|
|
||||||
|
|
||||||
struct HasDrop<T: ?Sized> {
|
struct HasDrop<T: ?Sized> {
|
||||||
ptr: Box<usize>,
|
ptr: Box<usize>,
|
||||||
data: T
|
data: T
|
||||||
|
@ -55,12 +49,6 @@ fn main() {
|
||||||
// The pointers should be the same
|
// The pointers should be the same
|
||||||
assert_eq!(ptr1, ptr2);
|
assert_eq!(ptr1, ptr2);
|
||||||
|
|
||||||
// Test that packed structs are handled correctly
|
|
||||||
let p : Packed<usize> = Packed { a: 0, b: 13 };
|
|
||||||
assert_eq!(p.b.get(), 13);
|
|
||||||
let p : &Packed<Bar> = &p;
|
|
||||||
assert_eq!(p.b.get(), 13);
|
|
||||||
|
|
||||||
// Test that nested DSTs work properly
|
// Test that nested DSTs work properly
|
||||||
let f : Foo<Foo<usize>> = Foo { a: 0, b: Foo { a: 1, b: 17 }};
|
let f : Foo<Foo<usize>> = Foo { a: 0, b: Foo { a: 1, b: 17 }};
|
||||||
assert_eq!(f.b.b.get(), 17);
|
assert_eq!(f.b.b.get(), 17);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue