Skip to content

Commit b67df9c

Browse files
bors[bot]CAD97
andauthored
Merge #56
56: Test panic in Thin::with_mut callback r=CAD97 a=CAD97 This may be a soundness hole, checking under miri... Co-authored-by: CAD97 <[email protected]>
2 parents 2a478c7 + 1cbcb41 commit b67df9c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

crates/erasable/tests/abuse.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,16 @@ impl DerefMut for MeanestDerefInTheWest {
4949
}
5050

5151
#[test]
52-
fn abuse() {
52+
fn meanest_deref_in_the_west() {
5353
let mut mean = Thin::from(MeanestDerefInTheWest::new());
5454
for _ in 0..10 {
5555
mean.deref_mut();
5656
}
5757
assert_eq!(*mean, 10);
5858
}
59+
60+
#[test]
61+
fn panic_with_mut() {
62+
let mut b: Thin<Box<u8>> = Box::new(0).into();
63+
std::panic::catch_unwind(move || Thin::with_mut(&mut b, |_| panic!())).unwrap_err();
64+
}

0 commit comments

Comments
 (0)