Skip to content

Commit

Permalink
adjust output for calling convention check
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Dec 24, 2021
1 parent a312297 commit 5ab0ea6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fn main() {

#[cfg(fn_ptr)]
unsafe { std::mem::transmute::<unsafe fn(), unsafe extern "C" fn()>(foo)() }
//[fn_ptr]~^ ERROR calling a function with ABI Rust using caller ABI C
//[fn_ptr]~^ ERROR calling a function with calling convention Rust using calling convention C

// `Instance` caching should not suppress ABI check.
#[cfg(cache)]
Expand All @@ -23,7 +23,7 @@ fn main() {
fn foo();
}
unsafe { foo() }
//[no_cache]~^ ERROR calling a function with ABI Rust using caller ABI C
//[cache]~^^ ERROR calling a function with ABI Rust using caller ABI C
//[no_cache]~^ ERROR calling a function with calling convention Rust using calling convention C
//[cache]~^^ ERROR calling a function with calling convention Rust using calling convention C
}
}
4 changes: 1 addition & 3 deletions tests/compile-fail/panic/bad_unwind.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// error-pattern: calling a function with ABI C-unwind using caller ABI C
// error-pattern: unwinding past a stack frame that does not allow unwinding
#![feature(c_unwind)]

//! Unwinding when the caller ABI is "C" (without "-unwind") is UB.
//! Currently we detect the ABI mismatch; we could probably allow such calls in principle one day
//! but then we have to detect the unexpected unwinding.
extern "C-unwind" fn unwind() {
panic!();
Expand Down

0 comments on commit 5ab0ea6

Please sign in to comment.