Skip to content

Commit 92cf7ae

Browse files
authored
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. 😄
2 parents 4269e52 + c7f9811 commit 92cf7ae

File tree

1 file changed

+0
-12
lines changed

1 file changed

+0
-12
lines changed

src/test/run-pass/dst-field-align.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ struct Baz<T: ?Sized> {
2525
a: T
2626
}
2727

28-
#[repr(packed)]
29-
struct Packed<T: ?Sized> {
30-
a: u8,
31-
b: T
32-
}
33-
3428
struct HasDrop<T: ?Sized> {
3529
ptr: Box<usize>,
3630
data: T
@@ -55,12 +49,6 @@ fn main() {
5549
// The pointers should be the same
5650
assert_eq!(ptr1, ptr2);
5751

58-
// Test that packed structs are handled correctly
59-
let p : Packed<usize> = Packed { a: 0, b: 13 };
60-
assert_eq!(p.b.get(), 13);
61-
let p : &Packed<Bar> = &p;
62-
assert_eq!(p.b.get(), 13);
63-
6452
// Test that nested DSTs work properly
6553
let f : Foo<Foo<usize>> = Foo { a: 0, b: Foo { a: 1, b: 17 }};
6654
assert_eq!(f.b.b.get(), 17);

0 commit comments

Comments
 (0)