summaryrefslogtreecommitdiff
path: root/src/tools/miri/tests/fail/terminate-terminator.rs
blob: f4931659fc82ad906dfda10553f84b087af1abdf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//@compile-flags: -Zmir-opt-level=3
// Enable MIR inlining to ensure that `TerminatorKind::Terminate` is generated
// instead of just `UnwindAction::Terminate`.

#![feature(c_unwind)]

struct Foo;

impl Drop for Foo {
    fn drop(&mut self) {}
}

#[inline(always)]
fn has_cleanup() {
    //~^ ERROR: panic in a function that cannot unwind
    // FIXME(nbdd0121): The error should be reported at the call site.
    let _f = Foo;
    panic!();
}

extern "C" fn panic_abort() {
    has_cleanup();
}

fn main() {
    panic_abort();
}