diff --git a/src/test/ui/union/union-generic-rpass.rs b/src/test/ui/union/union-generic-rpass.rs index 5ca3bc0f722..eb169c516d2 100644 --- a/src/test/ui/union/union-generic-rpass.rs +++ b/src/test/ui/union/union-generic-rpass.rs @@ -3,8 +3,10 @@ #![feature(untagged_unions)] -union MaybeItem where T::Item: Copy { - elem: T::Item, +use std::mem::ManuallyDrop; + +union MaybeItem { + elem: ManuallyDrop, none: (), } @@ -25,7 +27,7 @@ fn main() { let v: Vec = vec![1, 2, 3]; let mut i = v.iter(); i.next(); - let mi = MaybeItem::> { elem: i.next().unwrap() }; - assert_eq!(*mi.elem, 2); + let mi = MaybeItem::> { elem: ManuallyDrop::new(i.next().unwrap()) }; + assert_eq!(**mi.elem, 2); } }