mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-22 18:15:07 +03:00
Auto merge of #102732 - RalfJung:assert_unsafe_precondition2, r=bjorn3
nicer errors from assert_unsafe_precondition This makes the errors shown by cargo-careful nicer, and since `panic_no_unwind` is `nounwind noreturn` it hopefully doesn't have bad codegen impact. Thanks to `@bjorn3` for the hint! Would be nice if we could somehow supply our own (static) message to print, currently it always prints `panic in a function that cannot unwind`. But still, this is better than before.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
//@revisions: extern_block definition both
|
||||
#![feature(rustc_attrs, c_unwind)]
|
||||
|
||||
#[cfg_attr(any(definition, both), rustc_allocator_nounwind)]
|
||||
#[cfg_attr(any(definition, both), rustc_nounwind)]
|
||||
#[no_mangle]
|
||||
extern "C-unwind" fn nounwind() {
|
||||
//[definition]~^ ERROR: abnormal termination: the program aborted execution
|
||||
@@ -11,7 +11,7 @@ extern "C-unwind" fn nounwind() {
|
||||
|
||||
fn main() {
|
||||
extern "C-unwind" {
|
||||
#[cfg_attr(any(extern_block, both), rustc_allocator_nounwind)]
|
||||
#[cfg_attr(any(extern_block, both), rustc_nounwind)]
|
||||
fn nounwind();
|
||||
}
|
||||
unsafe { nounwind() }
|
||||
|
||||
@@ -379,7 +379,7 @@ macro_rules! experimental {
|
||||
// ==========================================================================
|
||||
|
||||
rustc_attr!(rustc_allocator, Normal, template!(Word), WarnFollowing, IMPL_DETAIL),
|
||||
rustc_attr!(rustc_allocator_nounwind, Normal, template!(Word), WarnFollowing, IMPL_DETAIL),
|
||||
rustc_attr!(rustc_nounwind, Normal, template!(Word), WarnFollowing, IMPL_DETAIL),
|
||||
gated!(
|
||||
alloc_error_handler, Normal, template!(Word), WarnFollowing,
|
||||
experimental!(alloc_error_handler)
|
||||
|
||||
Reference in New Issue
Block a user