File tree 2 files changed +13
-5
lines changed 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -2092,19 +2092,27 @@ mod tests {
2092
2092
}
2093
2093
}
2094
2094
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
+
2095
2100
let mut vec: SmallVec < [ PanicOnDoubleDrop ; 0 ] > = vec ! [
2096
2101
PanicOnDoubleDrop {
2097
- dropped: Box :: new ( false ) ,
2102
+ dropped: unsafe { Box :: from_raw ( & mut * box1 ) } ,
2098
2103
} ,
2099
2104
PanicOnDoubleDrop {
2100
- dropped: Box :: new ( false ) ,
2105
+ dropped: unsafe { Box :: from_raw ( & mut * box2 ) } ,
2101
2106
} ,
2102
2107
]
2103
2108
. into ( ) ;
2104
2109
let result = :: std:: panic:: catch_unwind ( move || {
2105
2110
vec. insert_many ( 0 , BadIter ) ;
2106
2111
} ) ;
2107
2112
assert ! ( result. is_err( ) ) ;
2113
+
2114
+ drop ( box1) ;
2115
+ drop ( box2) ;
2108
2116
}
2109
2117
2110
2118
#[ test]
Original file line number Diff line number Diff line change @@ -16,6 +16,6 @@ rustup default "$MIRI_NIGHTLY"
16
16
rustup component add miri
17
17
cargo miri setup
18
18
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