Skip to content

Commit

Permalink
Preserve originally intended test semantics
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Oct 11, 2019
1 parent 50ec10e commit 9c1ad0f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/test/ui/union/union-generic-rpass.rs
Expand Up @@ -3,8 +3,10 @@

#![feature(untagged_unions)]

union MaybeItem<T: Iterator> where T::Item: Copy {
elem: T::Item,
use std::mem::ManuallyDrop;

union MaybeItem<T: Iterator> {
elem: ManuallyDrop<T::Item>,
none: (),
}

Expand All @@ -25,7 +27,7 @@ fn main() {
let v: Vec<u8> = vec![1, 2, 3];
let mut i = v.iter();
i.next();
let mi = MaybeItem::<std::slice::Iter<_>> { elem: i.next().unwrap() };
assert_eq!(*mi.elem, 2);
let mi = MaybeItem::<std::slice::Iter<_>> { elem: ManuallyDrop::new(i.next().unwrap()) };
assert_eq!(**mi.elem, 2);
}
}

0 comments on commit 9c1ad0f

Please sign in to comment.