From aec8bbd5c8b03ae46bd887b52f5a5498faccc8f1 Mon Sep 17 00:00:00 2001 From: Jules Bertholet Date: Thu, 14 Apr 2022 14:37:38 -0400 Subject: [PATCH] Strip out broken Emscripten unwinding code --- compiler/rustc_codegen_llvm/src/context.rs | 21 --- compiler/rustc_codegen_llvm/src/intrinsic.rs | 87 ------------ compiler/rustc_codegen_ssa/src/back/link.rs | 11 +- compiler/rustc_hir/src/lang_items.rs | 1 - compiler/rustc_hir/src/weak_lang_items.rs | 1 - .../rustc_middle/src/middle/lang_items.rs | 4 +- compiler/rustc_passes/src/weak_lang_items.rs | 3 - compiler/rustc_span/src/symbol.rs | 2 - .../src/spec/wasm32_unknown_emscripten.rs | 6 +- library/panic_abort/src/lib.rs | 11 -- library/panic_unwind/src/emcc.rs | 132 ------------------ library/panic_unwind/src/lib.rs | 10 +- library/unwind/src/lib.rs | 3 +- library/unwind/src/libunwind.rs | 3 - .../src/language-features/lang-items.md | 5 - .../const-eval/const_panic_libcore_bin.rs | 2 - .../ui/lang-items/no_owned_box_lang_item.rs | 1 - .../macros/macro-comma-behavior.core.stderr | 16 +-- src/test/ui/macros/macro-comma-behavior.rs | 1 - .../ui/macros/macro-comma-behavior.std.stderr | 26 ++-- .../auxiliary/panic-runtime-lang-items.rs | 2 - src/test/ui/range/issue-54505-no-std.rs | 5 +- src/test/ui/range/issue-54505-no-std.stderr | 24 ++-- 23 files changed, 42 insertions(+), 335 deletions(-) delete mode 100644 library/panic_unwind/src/emcc.rs diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs index 5544f0d3f6058..279433f4e610e 100644 --- a/compiler/rustc_codegen_llvm/src/context.rs +++ b/compiler/rustc_codegen_llvm/src/context.rs @@ -99,7 +99,6 @@ pub struct CodegenCx<'ll, 'tcx> { pub dbg_cx: Option>, eh_personality: Cell>, - eh_catch_typeinfo: Cell>, pub rust_try_fn: Cell>, intrinsics: RefCell>, @@ -439,7 +438,6 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> { coverage_cx, dbg_cx, eh_personality: Cell::new(None), - eh_catch_typeinfo: Cell::new(None), rust_try_fn: Cell::new(None), intrinsics: Default::default(), local_gen_sym_counter: Cell::new(0), @@ -889,25 +887,6 @@ impl<'ll> CodegenCx<'ll, '_> { } None } - - pub(crate) fn eh_catch_typeinfo(&self) -> &'ll Value { - if let Some(eh_catch_typeinfo) = self.eh_catch_typeinfo.get() { - return eh_catch_typeinfo; - } - let tcx = self.tcx; - assert!(self.sess().target.is_like_emscripten); - let eh_catch_typeinfo = match tcx.lang_items().eh_catch_typeinfo() { - Some(def_id) => self.get_static(def_id), - _ => { - let ty = self - .type_struct(&[self.type_ptr_to(self.type_isize()), self.type_i8p()], false); - self.declare_global("rust_eh_catch_typeinfo", ty) - } - }; - let eh_catch_typeinfo = self.const_bitcast(eh_catch_typeinfo, self.type_i8p()); - self.eh_catch_typeinfo.set(Some(eh_catch_typeinfo)); - eh_catch_typeinfo - } } impl CodegenCx<'_, '_> { diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs index 9927f5f399bcd..cdd5c96f8a006 100644 --- a/compiler/rustc_codegen_llvm/src/intrinsic.rs +++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs @@ -431,8 +431,6 @@ fn try_intrinsic<'ll>( bx.store(bx.const_i32(0), dest, ret_align); } else if wants_msvc_seh(bx.sess()) { codegen_msvc_try(bx, try_func, data, catch_func, dest); - } else if bx.sess().target.is_like_emscripten { - codegen_emcc_try(bx, try_func, data, catch_func, dest); } else { codegen_gnu_try(bx, try_func, data, catch_func, dest); } @@ -656,91 +654,6 @@ fn codegen_gnu_try<'ll>( bx.store(ret, dest, i32_align); } -// Variant of codegen_gnu_try used for emscripten where Rust panics are -// implemented using C++ exceptions. Here we use exceptions of a specific type -// (`struct rust_panic`) to represent Rust panics. -fn codegen_emcc_try<'ll>( - bx: &mut Builder<'_, 'll, '_>, - try_func: &'ll Value, - data: &'ll Value, - catch_func: &'ll Value, - dest: &'ll Value, -) { - let (llty, llfn) = get_rust_try_fn(bx, &mut |mut bx| { - // Codegens the shims described above: - // - // bx: - // invoke %try_func(%data) normal %normal unwind %catch - // - // normal: - // ret 0 - // - // catch: - // (%ptr, %selector) = landingpad - // %rust_typeid = @llvm.eh.typeid.for(@_ZTI10rust_panic) - // %is_rust_panic = %selector == %rust_typeid - // %catch_data = alloca { i8*, i8 } - // %catch_data[0] = %ptr - // %catch_data[1] = %is_rust_panic - // call %catch_func(%data, %catch_data) - // ret 1 - let then = bx.append_sibling_block("then"); - let catch = bx.append_sibling_block("catch"); - - let try_func = llvm::get_param(bx.llfn(), 0); - let data = llvm::get_param(bx.llfn(), 1); - let catch_func = llvm::get_param(bx.llfn(), 2); - let try_func_ty = bx.type_func(&[bx.type_i8p()], bx.type_void()); - bx.invoke(try_func_ty, try_func, &[data], then, catch, None); - - bx.switch_to_block(then); - bx.ret(bx.const_i32(0)); - - // Type indicator for the exception being thrown. - // - // The first value in this tuple is a pointer to the exception object - // being thrown. The second value is a "selector" indicating which of - // the landing pad clauses the exception's type had been matched to. - bx.switch_to_block(catch); - let tydesc = bx.eh_catch_typeinfo(); - let lpad_ty = bx.type_struct(&[bx.type_i8p(), bx.type_i32()], false); - let vals = bx.landing_pad(lpad_ty, bx.eh_personality(), 2); - bx.add_clause(vals, tydesc); - bx.add_clause(vals, bx.const_null(bx.type_i8p())); - let ptr = bx.extract_value(vals, 0); - let selector = bx.extract_value(vals, 1); - - // Check if the typeid we got is the one for a Rust panic. - let rust_typeid = bx.call_intrinsic("llvm.eh.typeid.for", &[tydesc]); - let is_rust_panic = bx.icmp(IntPredicate::IntEQ, selector, rust_typeid); - let is_rust_panic = bx.zext(is_rust_panic, bx.type_bool()); - - // We need to pass two values to catch_func (ptr and is_rust_panic), so - // create an alloca and pass a pointer to that. - let ptr_align = bx.tcx().data_layout.pointer_align.abi; - let i8_align = bx.tcx().data_layout.i8_align.abi; - let catch_data_type = bx.type_struct(&[bx.type_i8p(), bx.type_bool()], false); - let catch_data = bx.alloca(catch_data_type, ptr_align); - let catch_data_0 = - bx.inbounds_gep(catch_data_type, catch_data, &[bx.const_usize(0), bx.const_usize(0)]); - bx.store(ptr, catch_data_0, ptr_align); - let catch_data_1 = - bx.inbounds_gep(catch_data_type, catch_data, &[bx.const_usize(0), bx.const_usize(1)]); - bx.store(is_rust_panic, catch_data_1, i8_align); - let catch_data = bx.bitcast(catch_data, bx.type_i8p()); - - let catch_ty = bx.type_func(&[bx.type_i8p(), bx.type_i8p()], bx.type_void()); - bx.call(catch_ty, catch_func, &[data, catch_data], None); - bx.ret(bx.const_i32(1)); - }); - - // Note that no invoke is used here because by definition this function - // can't panic (that's what it's catching). - let ret = bx.call(llty, llfn, &[try_func, data, catch_func], None); - let i32_align = bx.tcx().data_layout.i32_align.abi; - bx.store(ret, dest, i32_align); -} - // Helper function to give a Block to a closure to codegen a shim function. // This is currently primarily used for the `try` intrinsic functions above. fn gen_fn<'ll, 'tcx>( diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index 1f5e2b76bf0dc..edf49cdcf1bca 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -21,7 +21,7 @@ use rustc_span::symbol::Symbol; use rustc_span::DebuggerVisualizerFile; use rustc_target::spec::crt_objects::{CrtObjects, CrtObjectsFallback}; use rustc_target::spec::{LinkOutputKind, LinkerFlavor, LldFlavor, SplitDebuginfo}; -use rustc_target::spec::{PanicStrategy, RelocModel, RelroLevel, SanitizerSet, Target}; +use rustc_target::spec::{RelocModel, RelroLevel, SanitizerSet, Target}; use super::archive::{find_library, ArchiveBuilder}; use super::command::Command; @@ -2047,15 +2047,6 @@ fn add_order_independent_options( cmd.no_crt_objects(); } - if sess.target.is_like_emscripten { - cmd.arg("-s"); - cmd.arg(if sess.panic_strategy() == PanicStrategy::Abort { - "DISABLE_EXCEPTION_CATCHING=1" - } else { - "DISABLE_EXCEPTION_CATCHING=0" - }); - } - if flavor == LinkerFlavor::PtxLinker { // Provide the linker with fallback to internal `target-cpu`. cmd.arg("--fallback-arch"); diff --git a/compiler/rustc_hir/src/lang_items.rs b/compiler/rustc_hir/src/lang_items.rs index 9e5d781892487..2bd7da08ec10b 100644 --- a/compiler/rustc_hir/src/lang_items.rs +++ b/compiler/rustc_hir/src/lang_items.rs @@ -270,7 +270,6 @@ language_item_table! { Start, sym::start, start_fn, Target::Fn, GenericRequirement::Exact(1); EhPersonality, sym::eh_personality, eh_personality, Target::Fn, GenericRequirement::None; - EhCatchTypeinfo, sym::eh_catch_typeinfo, eh_catch_typeinfo, Target::Static, GenericRequirement::None; OwnedBox, sym::owned_box, owned_box, Target::Struct, GenericRequirement::Minimum(1); diff --git a/compiler/rustc_hir/src/weak_lang_items.rs b/compiler/rustc_hir/src/weak_lang_items.rs index 78748209d1a5b..1da037107ae0b 100644 --- a/compiler/rustc_hir/src/weak_lang_items.rs +++ b/compiler/rustc_hir/src/weak_lang_items.rs @@ -42,6 +42,5 @@ impl LanguageItems { weak_lang_items! { panic_impl, PanicImpl, rust_begin_unwind; eh_personality, EhPersonality, rust_eh_personality; - eh_catch_typeinfo, EhCatchTypeinfo, rust_eh_catch_typeinfo; oom, Oom, rust_oom; } diff --git a/compiler/rustc_middle/src/middle/lang_items.rs b/compiler/rustc_middle/src/middle/lang_items.rs index cc9706f2d867c..61418c8b8381c 100644 --- a/compiler/rustc_middle/src/middle/lang_items.rs +++ b/compiler/rustc_middle/src/middle/lang_items.rs @@ -53,9 +53,7 @@ pub fn required(tcx: TyCtxt<'_>, lang_item: LangItem) -> bool { // symbols. Other panic runtimes ensure that the relevant symbols are // available to link things together, but they're never exercised. match tcx.sess.panic_strategy() { - PanicStrategy::Abort => { - lang_item != LangItem::EhPersonality && lang_item != LangItem::EhCatchTypeinfo - } + PanicStrategy::Abort => lang_item != LangItem::EhPersonality, PanicStrategy::Unwind => true, } } diff --git a/compiler/rustc_passes/src/weak_lang_items.rs b/compiler/rustc_passes/src/weak_lang_items.rs index 5411946343b74..93b2eac1cdd61 100644 --- a/compiler/rustc_passes/src/weak_lang_items.rs +++ b/compiler/rustc_passes/src/weak_lang_items.rs @@ -17,9 +17,6 @@ pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx>, items: &mut lang_items::LanguageItem if items.eh_personality().is_none() { items.missing.push(LangItem::EhPersonality); } - if tcx.sess.target.is_like_emscripten && items.eh_catch_typeinfo().is_none() { - items.missing.push(LangItem::EhCatchTypeinfo); - } let crate_items = tcx.hir_crate_items(()); for id in crate_items.foreign_items() { diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 7b0fa65e8086b..36d0bc41fa196 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -619,7 +619,6 @@ symbols! { e, edition_macro_pats, edition_panic, - eh_catch_typeinfo, eh_personality, emit_enum, emit_enum_variant, @@ -1164,7 +1163,6 @@ symbols! { rust_2024_preview, rust_begin_unwind, rust_cold_cc, - rust_eh_catch_typeinfo, rust_eh_personality, rust_eh_register_frames, rust_eh_unregister_frames, diff --git a/compiler/rustc_target/src/spec/wasm32_unknown_emscripten.rs b/compiler/rustc_target/src/spec/wasm32_unknown_emscripten.rs index cf4d09105916a..b65140123ce80 100644 --- a/compiler/rustc_target/src/spec/wasm32_unknown_emscripten.rs +++ b/compiler/rustc_target/src/spec/wasm32_unknown_emscripten.rs @@ -16,11 +16,7 @@ pub fn target() -> Target { let mut post_link_args = LinkArgs::new(); post_link_args.insert( LinkerFlavor::Em, - vec![ - "-s".into(), - "ABORTING_MALLOC=0".into(), - "-Wl,--fatal-warnings".into(), - ], + vec!["-s".into(), "ABORTING_MALLOC=0".into(), "-Wl,--fatal-warnings".into()], ); let opts = TargetOptions { diff --git a/library/panic_abort/src/lib.rs b/library/panic_abort/src/lib.rs index c9f2f53a7b818..96e891bef6c6e 100644 --- a/library/panic_abort/src/lib.rs +++ b/library/panic_abort/src/lib.rs @@ -134,17 +134,6 @@ pub mod personalities { 1 // `ExceptionContinueSearch` } - // Similar to above, this corresponds to the `eh_catch_typeinfo` lang item - // that's only used on Emscripten currently. - // - // Since panics don't generate exceptions and foreign exceptions are - // currently UB with -C panic=abort (although this may be subject to - // change), any catch_unwind calls will never use this typeinfo. - #[rustc_std_internal_symbol] - #[allow(non_upper_case_globals)] - #[cfg(target_os = "emscripten")] - static rust_eh_catch_typeinfo: [usize; 2] = [0; 2]; - // These two are called by our startup objects on i686-pc-windows-gnu, but // they don't need to do anything so the bodies are nops. #[rustc_std_internal_symbol] diff --git a/library/panic_unwind/src/emcc.rs b/library/panic_unwind/src/emcc.rs deleted file mode 100644 index 1ee69ff9cb285..0000000000000 --- a/library/panic_unwind/src/emcc.rs +++ /dev/null @@ -1,132 +0,0 @@ -//! Unwinding for *emscripten* target. -//! -//! Whereas Rust's usual unwinding implementation for Unix platforms -//! calls into the libunwind APIs directly, on Emscripten we instead -//! call into the C++ unwinding APIs. This is just an expedience since -//! Emscripten's runtime always implements those APIs and does not -//! implement libunwind. - -use alloc::boxed::Box; -use core::any::Any; -use core::intrinsics; -use core::mem; -use core::ptr; -use core::sync::atomic::{AtomicBool, Ordering}; -use libc::{self, c_int}; -use unwind as uw; - -// This matches the layout of std::type_info in C++ -#[repr(C)] -struct TypeInfo { - vtable: *const usize, - name: *const u8, -} -unsafe impl Sync for TypeInfo {} - -extern "C" { - // The leading `\x01` byte here is actually a magical signal to LLVM to - // *not* apply any other mangling like prefixing with a `_` character. - // - // This symbol is the vtable used by C++'s `std::type_info`. Objects of type - // `std::type_info`, type descriptors, have a pointer to this table. Type - // descriptors are referenced by the C++ EH structures defined above and - // that we construct below. - // - // Note that the real size is larger than 3 usize, but we only need our - // vtable to point to the third element. - #[link_name = "\x01_ZTVN10__cxxabiv117__class_type_infoE"] - static CLASS_TYPE_INFO_VTABLE: [usize; 3]; -} - -// std::type_info for a rust_panic class -#[lang = "eh_catch_typeinfo"] -static EXCEPTION_TYPE_INFO: TypeInfo = TypeInfo { - // Normally we would use .as_ptr().add(2) but this doesn't work in a const context. - vtable: unsafe { &CLASS_TYPE_INFO_VTABLE[2] }, - // This intentionally doesn't use the normal name mangling scheme because - // we don't want C++ to be able to produce or catch Rust panics. - name: b"rust_panic\0".as_ptr(), -}; - -struct Exception { - // This is necessary because C++ code can capture our exception with - // std::exception_ptr and rethrow it multiple times, possibly even in - // another thread. - caught: AtomicBool, - - // This needs to be an Option because the object's lifetime follows C++ - // semantics: when catch_unwind moves the Box out of the exception it must - // still leave the exception object in a valid state because its destructor - // is still going to be called by __cxa_end_catch. - data: Option>, -} - -pub unsafe fn cleanup(ptr: *mut u8) -> Box { - // intrinsics::try actually gives us a pointer to this structure. - #[repr(C)] - struct CatchData { - ptr: *mut u8, - is_rust_panic: bool, - } - let catch_data = &*(ptr as *mut CatchData); - - let adjusted_ptr = __cxa_begin_catch(catch_data.ptr as *mut libc::c_void) as *mut Exception; - let out = if catch_data.is_rust_panic { - let was_caught = (*adjusted_ptr).caught.swap(true, Ordering::SeqCst); - if was_caught { - // Since cleanup() isn't allowed to panic, we just abort instead. - intrinsics::abort(); - } - (*adjusted_ptr).data.take().unwrap() - } else { - super::__rust_foreign_exception(); - }; - __cxa_end_catch(); - out -} - -pub unsafe fn panic(data: Box) -> u32 { - let sz = mem::size_of_val(&data); - let exception = __cxa_allocate_exception(sz) as *mut Exception; - if exception.is_null() { - return uw::_URC_FATAL_PHASE1_ERROR as u32; - } - ptr::write(exception, Exception { caught: AtomicBool::new(false), data: Some(data) }); - __cxa_throw(exception as *mut _, &EXCEPTION_TYPE_INFO, exception_cleanup); -} - -extern "C" fn exception_cleanup(ptr: *mut libc::c_void) -> *mut libc::c_void { - unsafe { - if let Some(b) = (ptr as *mut Exception).read().data { - drop(b); - super::__rust_drop_panic(); - } - ptr - } -} - -// This is required by the compiler to exist (e.g., it's a lang item), but it's -// never actually called by the compiler. Emscripten EH doesn't use a -// personality function at all, it instead uses __cxa_find_matching_catch. -// Wasm error handling would use __gxx_personality_wasm0. -#[lang = "eh_personality"] -unsafe extern "C" fn rust_eh_personality( - _version: c_int, - _actions: uw::_Unwind_Action, - _exception_class: uw::_Unwind_Exception_Class, - _exception_object: *mut uw::_Unwind_Exception, - _context: *mut uw::_Unwind_Context, -) -> uw::_Unwind_Reason_Code { - core::intrinsics::abort() -} - -extern "C" { - fn __cxa_allocate_exception(thrown_size: libc::size_t) -> *mut libc::c_void; - fn __cxa_begin_catch(thrown_exception: *mut libc::c_void) -> *mut libc::c_void; - fn __cxa_end_catch(); - fn __cxa_throw( - thrown_exception: *mut libc::c_void, - tinfo: *const TypeInfo, - dest: extern "C" fn(*mut libc::c_void) -> *mut libc::c_void, - ) -> !; -} diff --git a/library/panic_unwind/src/lib.rs b/library/panic_unwind/src/lib.rs index f9acb42c46b99..141abc097d99a 100644 --- a/library/panic_unwind/src/lib.rs +++ b/library/panic_unwind/src/lib.rs @@ -5,8 +5,7 @@ //! essentially gets categorized into three buckets currently: //! //! 1. MSVC targets use SEH in the `seh.rs` file. -//! 2. Emscripten uses C++ exceptions in the `emcc.rs` file. -//! 3. All other targets use libunwind/libgcc in the `gcc.rs` file. +//! 2. All other targets use libunwind/libgcc in the `gcc.rs` file. //! //! More documentation about each implementation can be found in the respective //! module. @@ -32,10 +31,7 @@ use core::any::Any; use core::panic::BoxMeUp; cfg_if::cfg_if! { - if #[cfg(target_os = "emscripten")] { - #[path = "emcc.rs"] - mod real_imp; - } else if #[cfg(target_os = "hermit")] { + if #[cfg(target_os = "hermit")] { #[path = "hermit.rs"] mod real_imp; } else if #[cfg(target_os = "l4re")] { @@ -49,7 +45,7 @@ cfg_if::cfg_if! { all(target_family = "windows", target_env = "gnu"), target_os = "psp", target_os = "solid_asp3", - all(target_family = "unix", not(target_os = "espidf")), + all(target_family = "unix", not(any(target_os = "emscripten", target_os = "espidf"))), all(target_vendor = "fortanix", target_env = "sgx"), ))] { // Rust runtime's startup objects depend on these symbols, so make them public. diff --git a/library/unwind/src/lib.rs b/library/unwind/src/lib.rs index 52d737de7aef8..52d92ab205e13 100644 --- a/library/unwind/src/lib.rs +++ b/library/unwind/src/lib.rs @@ -14,6 +14,7 @@ cfg_if::cfg_if! { target_os = "l4re", target_os = "none", target_os = "espidf", + target_os = "emscripten", ))] { // These "unix" family members do not have unwinder. // Note this also matches x86_64-unknown-none-linuxkernel. @@ -28,7 +29,7 @@ cfg_if::cfg_if! { pub use libunwind::*; } else { // no unwinder on the system! - // - wasm32 (not emscripten, which is "unix" family) + // - wasm32 // - os=none ("bare metal" targets) // - os=hermit // - os=uefi diff --git a/library/unwind/src/libunwind.rs b/library/unwind/src/libunwind.rs index 7b78bda424bb0..7847c03dfa450 100644 --- a/library/unwind/src/libunwind.rs +++ b/library/unwind/src/libunwind.rs @@ -63,9 +63,6 @@ pub const unwinder_private_data_size: usize = 2; #[cfg(any(target_arch = "riscv64", target_arch = "riscv32"))] pub const unwinder_private_data_size: usize = 2; -#[cfg(target_os = "emscripten")] -pub const unwinder_private_data_size: usize = 20; - #[cfg(all(target_arch = "hexagon", target_os = "linux"))] pub const unwinder_private_data_size: usize = 35; diff --git a/src/doc/unstable-book/src/language-features/lang-items.md b/src/doc/unstable-book/src/language-features/lang-items.md index 86bedb51538b5..31ddaa8d37d0d 100644 --- a/src/doc/unstable-book/src/language-features/lang-items.md +++ b/src/doc/unstable-book/src/language-features/lang-items.md @@ -198,9 +198,6 @@ compiler. When a panic happens, this controls the message that's displayed on the screen. While the language item's name is `panic_impl`, the symbol name is `rust_begin_panic`. -Finally, a `eh_catch_typeinfo` static is needed for certain targets which -implement Rust panics on top of C++ exceptions. - ## List of all language items This is a list of all language items in Rust along with where they are located in @@ -229,10 +226,8 @@ the source code. - `unsafe_cell`: `libcore/cell.rs` - Runtime - `start`: `libstd/rt.rs` - - `eh_personality`: `libpanic_unwind/emcc.rs` (EMCC) - `eh_personality`: `libpanic_unwind/gcc.rs` (GNU) - `eh_personality`: `libpanic_unwind/seh.rs` (SEH) - - `eh_catch_typeinfo`: `libpanic_unwind/emcc.rs` (EMCC) - `panic`: `libcore/panicking.rs` - `panic_bounds_check`: `libcore/panicking.rs` - `panic_impl`: `libcore/panicking.rs` diff --git a/src/test/ui/consts/const-eval/const_panic_libcore_bin.rs b/src/test/ui/consts/const-eval/const_panic_libcore_bin.rs index d4dc1a51d73aa..9423c514508b0 100644 --- a/src/test/ui/consts/const-eval/const_panic_libcore_bin.rs +++ b/src/test/ui/consts/const-eval/const_panic_libcore_bin.rs @@ -16,8 +16,6 @@ const X: () = unimplemented!(); #[lang = "eh_personality"] fn eh() {} -#[lang = "eh_catch_typeinfo"] -static EH_CATCH_TYPEINFO: u8 = 0; #[panic_handler] fn panic(_info: &PanicInfo) -> ! { diff --git a/src/test/ui/lang-items/no_owned_box_lang_item.rs b/src/test/ui/lang-items/no_owned_box_lang_item.rs index c22b44ffca2a4..f677cefb728fc 100644 --- a/src/test/ui/lang-items/no_owned_box_lang_item.rs +++ b/src/test/ui/lang-items/no_owned_box_lang_item.rs @@ -12,5 +12,4 @@ fn main() { } #[lang = "eh_personality"] extern "C" fn eh_personality() {} -#[lang = "eh_catch_typeinfo"] static EH_CATCH_TYPEINFO: u8 = 0; #[lang = "panic_impl"] fn panic_impl(panic: &PanicInfo) -> ! { loop {} } diff --git a/src/test/ui/macros/macro-comma-behavior.core.stderr b/src/test/ui/macros/macro-comma-behavior.core.stderr index ac15e9fa8ea83..e84a33d1f8dee 100644 --- a/src/test/ui/macros/macro-comma-behavior.core.stderr +++ b/src/test/ui/macros/macro-comma-behavior.core.stderr @@ -1,47 +1,47 @@ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:21:23 + --> $DIR/macro-comma-behavior.rs:20:23 | LL | assert_eq!(1, 1, "{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:24:23 + --> $DIR/macro-comma-behavior.rs:23:23 | LL | assert_ne!(1, 2, "{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:30:29 + --> $DIR/macro-comma-behavior.rs:29:29 | LL | debug_assert_eq!(1, 1, "{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:33:29 + --> $DIR/macro-comma-behavior.rs:32:29 | LL | debug_assert_ne!(1, 2, "{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:52:19 + --> $DIR/macro-comma-behavior.rs:51:19 | LL | format_args!("{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:68:21 + --> $DIR/macro-comma-behavior.rs:67:21 | LL | unimplemented!("{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:77:24 + --> $DIR/macro-comma-behavior.rs:76:24 | LL | write!(f, "{}",)?; | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:81:26 + --> $DIR/macro-comma-behavior.rs:80:26 | LL | writeln!(f, "{}",)?; | ^^ diff --git a/src/test/ui/macros/macro-comma-behavior.rs b/src/test/ui/macros/macro-comma-behavior.rs index 27d50ff3d57ea..3de0374545d52 100644 --- a/src/test/ui/macros/macro-comma-behavior.rs +++ b/src/test/ui/macros/macro-comma-behavior.rs @@ -9,7 +9,6 @@ #[cfg(std)] use std::fmt; #[cfg(core)] use core::fmt; #[cfg(core)] #[lang = "eh_personality"] fn eh_personality() {} -#[cfg(core)] #[lang = "eh_catch_typeinfo"] static EH_CATCH_TYPEINFO: u8 = 0; #[cfg(core)] #[lang = "panic_impl"] fn panic_impl(panic: &core::panic::PanicInfo) -> ! { loop {} } // (see documentation of the similarly-named test in run-pass) diff --git a/src/test/ui/macros/macro-comma-behavior.std.stderr b/src/test/ui/macros/macro-comma-behavior.std.stderr index 7fd060e222498..e29737e0522a4 100644 --- a/src/test/ui/macros/macro-comma-behavior.std.stderr +++ b/src/test/ui/macros/macro-comma-behavior.std.stderr @@ -1,77 +1,77 @@ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:21:23 + --> $DIR/macro-comma-behavior.rs:20:23 | LL | assert_eq!(1, 1, "{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:24:23 + --> $DIR/macro-comma-behavior.rs:23:23 | LL | assert_ne!(1, 2, "{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:30:29 + --> $DIR/macro-comma-behavior.rs:29:29 | LL | debug_assert_eq!(1, 1, "{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:33:29 + --> $DIR/macro-comma-behavior.rs:32:29 | LL | debug_assert_ne!(1, 2, "{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:38:18 + --> $DIR/macro-comma-behavior.rs:37:18 | LL | eprint!("{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:43:20 + --> $DIR/macro-comma-behavior.rs:42:20 | LL | eprintln!("{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:48:18 + --> $DIR/macro-comma-behavior.rs:47:18 | LL | format!("{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:52:19 + --> $DIR/macro-comma-behavior.rs:51:19 | LL | format_args!("{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:59:17 + --> $DIR/macro-comma-behavior.rs:58:17 | LL | print!("{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:64:19 + --> $DIR/macro-comma-behavior.rs:63:19 | LL | println!("{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:68:21 + --> $DIR/macro-comma-behavior.rs:67:21 | LL | unimplemented!("{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:77:24 + --> $DIR/macro-comma-behavior.rs:76:24 | LL | write!(f, "{}",)?; | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:81:26 + --> $DIR/macro-comma-behavior.rs:80:26 | LL | writeln!(f, "{}",)?; | ^^ diff --git a/src/test/ui/panic-runtime/auxiliary/panic-runtime-lang-items.rs b/src/test/ui/panic-runtime/auxiliary/panic-runtime-lang-items.rs index b9ef2f329414e..3e5cdad7ab936 100644 --- a/src/test/ui/panic-runtime/auxiliary/panic-runtime-lang-items.rs +++ b/src/test/ui/panic-runtime/auxiliary/panic-runtime-lang-items.rs @@ -11,5 +11,3 @@ use core::panic::PanicInfo; fn panic_impl(info: &PanicInfo) -> ! { loop {} } #[lang = "eh_personality"] fn eh_personality() {} -#[lang = "eh_catch_typeinfo"] -static EH_CATCH_TYPEINFO: u8 = 0; diff --git a/src/test/ui/range/issue-54505-no-std.rs b/src/test/ui/range/issue-54505-no-std.rs index ab1a025b521a9..aa9637a238d25 100644 --- a/src/test/ui/range/issue-54505-no-std.rs +++ b/src/test/ui/range/issue-54505-no-std.rs @@ -11,12 +11,9 @@ use core::ops::RangeBounds; -#[cfg(any(not(target_arch = "wasm32"), target_os = "emscripten"))] +#[cfg(not(target_arch = "wasm32"))] #[lang = "eh_personality"] extern "C" fn eh_personality() {} -#[cfg(target_os = "emscripten")] -#[lang = "eh_catch_typeinfo"] -static EH_CATCH_TYPEINFO: u8 = 0; // take a reference to any built-in range diff --git a/src/test/ui/range/issue-54505-no-std.stderr b/src/test/ui/range/issue-54505-no-std.stderr index c4e36b0b15950..6f4d07fe78458 100644 --- a/src/test/ui/range/issue-54505-no-std.stderr +++ b/src/test/ui/range/issue-54505-no-std.stderr @@ -1,7 +1,7 @@ error: `#[panic_handler]` function required, but not found error[E0308]: mismatched types - --> $DIR/issue-54505-no-std.rs:27:16 + --> $DIR/issue-54505-no-std.rs:24:16 | LL | take_range(0..1); | ---------- ^^^^ @@ -13,13 +13,13 @@ LL | take_range(0..1); = note: expected reference `&_` found struct `Range<{integer}>` note: function defined here - --> $DIR/issue-54505-no-std.rs:23:4 + --> $DIR/issue-54505-no-std.rs:20:4 | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- error[E0308]: mismatched types - --> $DIR/issue-54505-no-std.rs:32:16 + --> $DIR/issue-54505-no-std.rs:29:16 | LL | take_range(1..); | ---------- ^^^ @@ -31,13 +31,13 @@ LL | take_range(1..); = note: expected reference `&_` found struct `RangeFrom<{integer}>` note: function defined here - --> $DIR/issue-54505-no-std.rs:23:4 + --> $DIR/issue-54505-no-std.rs:20:4 | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- error[E0308]: mismatched types - --> $DIR/issue-54505-no-std.rs:37:16 + --> $DIR/issue-54505-no-std.rs:34:16 | LL | take_range(..); | ---------- ^^ @@ -49,13 +49,13 @@ LL | take_range(..); = note: expected reference `&_` found struct `RangeFull` note: function defined here - --> $DIR/issue-54505-no-std.rs:23:4 + --> $DIR/issue-54505-no-std.rs:20:4 | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- error[E0308]: mismatched types - --> $DIR/issue-54505-no-std.rs:42:16 + --> $DIR/issue-54505-no-std.rs:39:16 | LL | take_range(0..=1); | ---------- ^^^^^ @@ -67,13 +67,13 @@ LL | take_range(0..=1); = note: expected reference `&_` found struct `RangeInclusive<{integer}>` note: function defined here - --> $DIR/issue-54505-no-std.rs:23:4 + --> $DIR/issue-54505-no-std.rs:20:4 | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- error[E0308]: mismatched types - --> $DIR/issue-54505-no-std.rs:47:16 + --> $DIR/issue-54505-no-std.rs:44:16 | LL | take_range(..5); | ---------- ^^^ @@ -85,13 +85,13 @@ LL | take_range(..5); = note: expected reference `&_` found struct `RangeTo<{integer}>` note: function defined here - --> $DIR/issue-54505-no-std.rs:23:4 + --> $DIR/issue-54505-no-std.rs:20:4 | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- error[E0308]: mismatched types - --> $DIR/issue-54505-no-std.rs:52:16 + --> $DIR/issue-54505-no-std.rs:49:16 | LL | take_range(..=42); | ---------- ^^^^^ @@ -103,7 +103,7 @@ LL | take_range(..=42); = note: expected reference `&_` found struct `RangeToInclusive<{integer}>` note: function defined here - --> $DIR/issue-54505-no-std.rs:23:4 + --> $DIR/issue-54505-no-std.rs:20:4 | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ -------------------------