File tree 4 files changed +58
-4
lines changed
src/tools/miri/tests/fail
4 files changed +58
-4
lines changed Original file line number Diff line number Diff line change
1
+ //@compile-flags: -Zmir-opt-level=3
2
+ // Enable MIR inlining to ensure that `TerminatorKind::Terminate` is generated
3
+ // instead of just `UnwindAction::Terminate`.
4
+
5
+ #![ feature( c_unwind) ]
6
+
7
+ struct Foo ;
8
+
9
+ impl Drop for Foo {
10
+ fn drop ( & mut self ) { }
11
+ }
12
+
13
+ #[ inline( always) ]
14
+ fn has_cleanup ( ) {
15
+ //~^ ERROR: panic in a function that cannot unwind
16
+ // FIXME(nbdd0121): The error should be reported at the call site.
17
+ let _f = Foo ;
18
+ panic ! ( ) ;
19
+ }
20
+
21
+ extern "C" fn panic_abort ( ) {
22
+ has_cleanup ( ) ;
23
+ }
24
+
25
+ fn main ( ) {
26
+ panic_abort ( ) ;
27
+ }
Original file line number Diff line number Diff line change
1
+ thread 'main' panicked at 'explicit panic', $DIR/terminate-terminator.rs:LL:CC
2
+ note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
3
+ error: abnormal termination: panic in a function that cannot unwind
4
+ --> $DIR/terminate-terminator.rs:LL:CC
5
+ |
6
+ LL | / fn has_cleanup() {
7
+ LL | |
8
+ LL | | // FIXME(nbdd0121): The error should be reported at the call site.
9
+ LL | | let _f = Foo;
10
+ LL | | panic!();
11
+ LL | | }
12
+ | |_^ panic in a function that cannot unwind
13
+ ...
14
+ LL | has_cleanup();
15
+ | ------------- in this inlined function call
16
+ |
17
+ = note: inside `panic_abort` at $DIR/terminate-terminator.rs:LL:CC
18
+ note: inside `main`
19
+ --> $DIR/terminate-terminator.rs:LL:CC
20
+ |
21
+ LL | panic_abort();
22
+ | ^^^^^^^^^^^^^
23
+
24
+ note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
25
+
26
+ error: aborting due to previous error
27
+
File renamed without changes.
Original file line number Diff line number Diff line change 1
- thread 'main' panicked at 'explicit panic', $DIR/abort-terminator .rs:LL:CC
1
+ thread 'main' panicked at 'explicit panic', $DIR/unwind-action-terminate .rs:LL:CC
2
2
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
3
3
error: abnormal termination: panic in a function that cannot unwind
4
- --> $DIR/abort-terminator .rs:LL:CC
4
+ --> $DIR/unwind-action-terminate .rs:LL:CC
5
5
|
6
6
LL | / extern "C" fn panic_abort() {
7
7
LL | |
8
8
LL | | panic!()
9
9
LL | | }
10
10
| |_^ panic in a function that cannot unwind
11
11
|
12
- = note: inside `panic_abort` at $DIR/abort-terminator .rs:LL:CC
12
+ = note: inside `panic_abort` at $DIR/unwind-action-terminate .rs:LL:CC
13
13
note: inside `main`
14
- --> $DIR/abort-terminator .rs:LL:CC
14
+ --> $DIR/unwind-action-terminate .rs:LL:CC
15
15
|
16
16
LL | panic_abort();
17
17
| ^^^^^^^^^^^^^
You can’t perform that action at this time.
0 commit comments