Skip to content

Commit

Permalink
Rollup merge of rust-lang#39692 - oli-obk:patch-2, r=aturon
Browse files Browse the repository at this point in the history
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. 😄
  • Loading branch information
frewsxcv authored Feb 10, 2017
2 parents 2376e42 + c7f9811 commit 8ff98aa
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions src/test/run-pass/dst-field-align.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ struct Baz<T: ?Sized> {
a: T
}

#[repr(packed)]
struct Packed<T: ?Sized> {
a: u8,
b: T
}

struct HasDrop<T: ?Sized> {
ptr: Box<usize>,
data: T
Expand All @@ -55,12 +49,6 @@ fn main() {
// The pointers should be the same
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
let f : Foo<Foo<usize>> = Foo { a: 0, b: Foo { a: 1, b: 17 }};
assert_eq!(f.b.b.get(), 17);
Expand Down

0 comments on commit 8ff98aa

Please sign in to comment.