Skip to content

Commit dde20f0

Browse files
committed
Update the test to be for realsies
1 parent ce9d14c commit dde20f0

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

tests/tests/neg/surface/no_panic07.rs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,23 @@ trait Ticks {
55
fn foo(&self) -> Self;
66
}
77

8-
#[flux::no_panic]
8+
// `call_ticks_0` and `call_ticks_1` should have identical behavior, but
9+
// right now, they don't because of the way we handle closures: closures
10+
// only inherit their `no_panic` status from the first parent who is annotated
11+
// with `no_panic`, effectively ignoring the `no_panic_if` annotation on `call_ticks_0`.
12+
// Boo!
13+
#[flux::sig(fn (_) -> ())]
14+
#[flux::no_panic_if(true)]
915
fn call_ticks_0<T: Ticks>(a: T) {
10-
// this (correctly) errors
11-
a.foo(); //~ ERROR may panic
16+
let x = || {
17+
a.foo(); //~ ERROR may panic
18+
};
1219
}
1320

14-
#[flux::no_panic_if(true)]
21+
#[flux::sig(fn (_) -> ())]
22+
#[flux::no_panic]
1523
fn call_ticks_1<T: Ticks>(a: T) {
16-
// this (buggy) for now, does not.
17-
a.foo(); //~ ERROR may panic
24+
let x = || {
25+
a.foo(); //~ ERROR may panic
26+
};
1827
}

0 commit comments

Comments
 (0)