Skip to content

Commit

Permalink
make union-drop mem::forget test meaningful
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Aug 31, 2020
1 parent fe21e4c commit 9c16cc2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/test/ui/union/union-drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ fn main() {
{
let y = Y { a: S };
}
assert_eq!(CHECK, 2); // 2, dtor of Y is called
assert_eq!(CHECK, 2); // 2, Y has no dtor
{
let y2 = Y { a: S };
std::mem::forget(y2);
let u2 = U { a: 1 };
std::mem::forget(u2);
}
assert_eq!(CHECK, 2); // 2, dtor of Y *not* called for y2
assert_eq!(CHECK, 2); // 2, dtor of U *not* called for u2
}
}

0 comments on commit 9c16cc2

Please sign in to comment.