@@ -216,12 +216,13 @@ fn panic_propagate_nested_scope_spawn() {
216
216
#[ cfg_attr( not( panic = "unwind" ) , ignore) ]
217
217
fn panic_propagate_still_execute_1 ( ) {
218
218
let mut x = false ;
219
- match unwind:: halt_unwinding ( || {
219
+ let result = unwind:: halt_unwinding ( || {
220
220
scope ( |s| {
221
221
s. spawn ( |_| panic ! ( "Hello, world!" ) ) ; // job A
222
222
s. spawn ( |_| x = true ) ; // job B, should still execute even though A panics
223
223
} ) ;
224
- } ) {
224
+ } ) ;
225
+ match result {
225
226
Ok ( _) => panic ! ( "failed to propagate panic" ) ,
226
227
Err ( _) => assert ! ( x, "job b failed to execute" ) ,
227
228
}
@@ -231,12 +232,13 @@ fn panic_propagate_still_execute_1() {
231
232
#[ cfg_attr( not( panic = "unwind" ) , ignore) ]
232
233
fn panic_propagate_still_execute_2 ( ) {
233
234
let mut x = false ;
234
- match unwind:: halt_unwinding ( || {
235
+ let result = unwind:: halt_unwinding ( || {
235
236
scope ( |s| {
236
237
s. spawn ( |_| x = true ) ; // job B, should still execute even though A panics
237
238
s. spawn ( |_| panic ! ( "Hello, world!" ) ) ; // job A
238
239
} ) ;
239
- } ) {
240
+ } ) ;
241
+ match result {
240
242
Ok ( _) => panic ! ( "failed to propagate panic" ) ,
241
243
Err ( _) => assert ! ( x, "job b failed to execute" ) ,
242
244
}
@@ -246,12 +248,13 @@ fn panic_propagate_still_execute_2() {
246
248
#[ cfg_attr( not( panic = "unwind" ) , ignore) ]
247
249
fn panic_propagate_still_execute_3 ( ) {
248
250
let mut x = false ;
249
- match unwind:: halt_unwinding ( || {
251
+ let result = unwind:: halt_unwinding ( || {
250
252
scope ( |s| {
251
253
s. spawn ( |_| x = true ) ; // spawned job should still execute despite later panic
252
254
panic ! ( "Hello, world!" ) ;
253
255
} ) ;
254
- } ) {
256
+ } ) ;
257
+ match result {
255
258
Ok ( _) => panic ! ( "failed to propagate panic" ) ,
256
259
Err ( _) => assert ! ( x, "panic after spawn, spawn failed to execute" ) ,
257
260
}
@@ -261,12 +264,13 @@ fn panic_propagate_still_execute_3() {
261
264
#[ cfg_attr( not( panic = "unwind" ) , ignore) ]
262
265
fn panic_propagate_still_execute_4 ( ) {
263
266
let mut x = false ;
264
- match unwind:: halt_unwinding ( || {
267
+ let result = unwind:: halt_unwinding ( || {
265
268
scope ( |s| {
266
269
s. spawn ( |_| panic ! ( "Hello, world!" ) ) ;
267
270
x = true ;
268
271
} ) ;
269
- } ) {
272
+ } ) ;
273
+ match result {
270
274
Ok ( _) => panic ! ( "failed to propagate panic" ) ,
271
275
Err ( _) => assert ! ( x, "panic in spawn tainted scope" ) ,
272
276
}
0 commit comments