File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -2092,19 +2092,27 @@ mod tests {
20922092 }
20932093 }
20942094
2095+ // These boxes are leaked on purpose by panicking `insert_many`,
2096+ // so we clean them up manually to appease Miri's leak checker.
2097+ let mut box1 = Box :: new ( false ) ;
2098+ let mut box2 = Box :: new ( false ) ;
2099+
20952100 let mut vec: SmallVec < [ PanicOnDoubleDrop ; 0 ] > = vec ! [
20962101 PanicOnDoubleDrop {
2097- dropped: Box :: new ( false ) ,
2102+ dropped: unsafe { Box :: from_raw ( & mut * box1 ) } ,
20982103 } ,
20992104 PanicOnDoubleDrop {
2100- dropped: Box :: new ( false ) ,
2105+ dropped: unsafe { Box :: from_raw ( & mut * box2 ) } ,
21012106 } ,
21022107 ]
21032108 . into ( ) ;
21042109 let result = :: std:: panic:: catch_unwind ( move || {
21052110 vec. insert_many ( 0 , BadIter ) ;
21062111 } ) ;
21072112 assert ! ( result. is_err( ) ) ;
2113+
2114+ drop ( box1) ;
2115+ drop ( box2) ;
21082116 }
21092117
21102118 #[ test]
Original file line number Diff line number Diff line change @@ -16,6 +16,6 @@ rustup default "$MIRI_NIGHTLY"
1616rustup component add miri
1717cargo miri setup
1818
19- cargo miri test --verbose -- -Zmiri-ignore-leaks
20- cargo miri test --verbose --features union -- -Zmiri-ignore-leaks
21- cargo miri test --verbose --all-features -- -Zmiri-ignore-leaks
19+ cargo miri test --verbose
20+ cargo miri test --verbose --features union
21+ cargo miri test --verbose --all-features
You can’t perform that action at this time.
0 commit comments