From 9b7623a1621a3fedd1eb7f3cdac4b48e9f819013 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Mon, 25 May 2026 20:11:36 +0200 Subject: [PATCH] Remove -Zemscripten-wasm-eh This was necessary when transitioning from JS to wasm exception handling on Emscripten. Enough time has probably passed that we no longer need to support JS exception handling on Emscripten. This enables cleaning up a fair bit of code. --- compiler/rustc_codegen_llvm/src/context.rs | 20 --- compiler/rustc_codegen_llvm/src/intrinsic.rs | 85 +---------- compiler/rustc_codegen_llvm/src/llvm_util.rs | 7 - compiler/rustc_codegen_llvm/src/type_.rs | 4 - compiler/rustc_codegen_ssa/src/back/link.rs | 8 +- compiler/rustc_codegen_ssa/src/base.rs | 1 - compiler/rustc_feature/src/builtin_attrs.rs | 1 - compiler/rustc_feature/src/unstable.rs | 2 - compiler/rustc_hir/src/lang_items.rs | 1 - compiler/rustc_hir/src/weak_lang_items.rs | 1 - compiler/rustc_interface/src/tests.rs | 1 - .../rustc_middle/src/middle/lang_items.rs | 8 +- compiler/rustc_passes/src/weak_lang_items.rs | 13 +- compiler/rustc_session/src/config/cfg.rs | 6 - compiler/rustc_session/src/options.rs | 2 - compiler/rustc_span/src/symbol.rs | 4 - library/panic_abort/src/lib.rs | 43 ------ library/panic_unwind/Cargo.toml | 4 - library/panic_unwind/src/emcc.rs | 135 ------------------ library/panic_unwind/src/lib.rs | 15 +- library/unwind/Cargo.toml | 2 +- library/unwind/src/lib.rs | 3 +- .../wasm32-unknown-emscripten.md | 3 +- .../src/compiler-flags/emscripten-wasm-eh.md | 6 - .../src/language-features/lang-items.md | 3 +- .../emscripten-catch-unwind-js-eh.rs | 71 --------- ...-wasm-eh.rs => emscripten-catch-unwind.rs} | 4 +- tests/codegen-llvm/terminating-catchpad.rs | 2 +- tests/codegen-llvm/wasm_exceptions.rs | 2 +- ...llowed-cli-cfgs.emscripten_wasm_eh_.stderr | 8 -- tests/ui/cfg/disallowed-cli-cfgs.rs | 2 - .../const-eval/const_panic_libcore_bin.rs | 2 - tests/ui/extern-flag/empty-extern-arg.rs | 1 - .../feature-gate-cfg-emscripten-wasm-eh.rs | 4 - ...feature-gate-cfg-emscripten-wasm-eh.stderr | 12 -- .../macros/macro-comma-behavior.core.stderr | 16 +-- tests/ui/macros/macro-comma-behavior.rs | 1 - .../ui/macros/macro-comma-behavior.std.stderr | 26 ++-- tests/ui/panic-handler/weak-lang-item.rs | 1 - tests/ui/panic-handler/weak-lang-item.stderr | 2 +- .../auxiliary/panic-runtime-lang-items.rs | 2 - tests/ui/range/issue-54505-no-std.rs | 3 - tests/ui/range/issue-54505-no-std.stderr | 26 ++-- 43 files changed, 56 insertions(+), 507 deletions(-) delete mode 100644 library/panic_unwind/src/emcc.rs delete mode 100644 src/doc/unstable-book/src/compiler-flags/emscripten-wasm-eh.md delete mode 100644 tests/codegen-llvm/emscripten-catch-unwind-js-eh.rs rename tests/codegen-llvm/{emscripten-catch-unwind-wasm-eh.rs => emscripten-catch-unwind.rs} (96%) delete mode 100644 tests/ui/cfg/disallowed-cli-cfgs.emscripten_wasm_eh_.stderr delete mode 100644 tests/ui/feature-gates/feature-gate-cfg-emscripten-wasm-eh.rs delete mode 100644 tests/ui/feature-gates/feature-gate-cfg-emscripten-wasm-eh.stderr diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs index 6e0ff1c75149b..85a7f9cab73a4 100644 --- a/compiler/rustc_codegen_llvm/src/context.rs +++ b/compiler/rustc_codegen_llvm/src/context.rs @@ -26,7 +26,6 @@ use rustc_session::config::{ BranchProtection, CFGuard, CFProtection, CrateType, DebugInfo, FunctionReturn, PAuthKey, PacRet, }; use rustc_span::{DUMMY_SP, Span, Spanned, Symbol, sym}; -use rustc_symbol_mangling::mangle_internal_symbol; use rustc_target::spec::{ Arch, CfgAbi, Env, FramePointer, HasTargetSpec, Os, RelocModel, SmallDataThresholdSupport, Target, TlsModel, @@ -136,7 +135,6 @@ pub(crate) struct FullCx<'ll, 'tcx> { pub dbg_cx: Option>, eh_personality: Cell>, - eh_catch_typeinfo: Cell>, pub rust_try_fn: Cell>, intrinsics: @@ -672,7 +670,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), @@ -1042,23 +1039,6 @@ impl<'ll> CodegenCx<'ll, '_> { } } } - - 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.os == Os::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(), self.type_ptr()], false); - self.declare_global(&mangle_internal_symbol(self.tcx, "rust_eh_catch_typeinfo"), ty) - } - }; - 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 1c7b415fd04c7..393837375769e 100644 --- a/compiler/rustc_codegen_llvm/src/intrinsic.rs +++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs @@ -28,7 +28,7 @@ use rustc_session::lint::builtin::DEPRECATED_LLVM_INTRINSIC; use rustc_span::{ErrorGuaranteed, Span, Symbol, sym}; use rustc_symbol_mangling::{mangle_internal_symbol, symbol_name_for_instance_in_crate}; use rustc_target::callconv::PassMode; -use rustc_target::spec::{Arch, Os}; +use rustc_target::spec::Arch; use tracing::debug; use crate::abi::FnAbiLlvmExt; @@ -1356,8 +1356,6 @@ fn catch_unwind_intrinsic<'ll, 'tcx>( codegen_msvc_try(bx, try_func, data, catch_func) } else if wants_wasm_eh(bx.sess()) { codegen_wasm_try(bx, try_func, data, catch_func) - } else if bx.sess().target.os == Os::Emscripten { - codegen_emcc_try(bx, try_func, data, catch_func) } else { codegen_gnu_try(bx, try_func, data, catch_func) } @@ -1654,87 +1652,6 @@ fn codegen_gnu_try<'ll, 'tcx>( ret } -// 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, 'tcx>( - bx: &mut Builder<'_, 'll, 'tcx>, - try_func: &'ll Value, - data: &'ll Value, - catch_func: &'ll Value, -) -> &'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_ptr()], bx.type_void()); - bx.invoke(try_func_ty, None, None, try_func, &[data], then, catch, None, None); - - bx.switch_to_block(then); - bx.ret(bx.const_bool(false)); - - // 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_ptr(), 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_ptr())); - 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", &[bx.val_ty(tydesc)], &[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_size = bx.tcx().data_layout.pointer_size(); - let ptr_align = bx.tcx().data_layout.pointer_align().abi; - let i8_align = bx.tcx().data_layout.i8_align; - // Required in order for there to be no padding between the fields. - assert!(i8_align <= ptr_align); - let catch_data = bx.alloca(2 * ptr_size, ptr_align); - bx.store(ptr, catch_data, ptr_align); - let catch_data_1 = bx.inbounds_ptradd(catch_data, bx.const_usize(ptr_size.bytes())); - bx.store(is_rust_panic, catch_data_1, i8_align); - - let catch_ty = bx.type_func(&[bx.type_ptr(), bx.type_ptr()], bx.type_void()); - bx.call(catch_ty, None, None, catch_func, &[data, catch_data], None, None); - bx.ret(bx.const_bool(true)); - }); - - // 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, None, None, llfn, &[try_func, data, catch_func], None, None); - ret -} - // 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<'a, 'll, 'tcx>( diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs index eb1efa31ae4ab..73b7f699b606d 100644 --- a/compiler/rustc_codegen_llvm/src/llvm_util.rs +++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs @@ -109,13 +109,6 @@ unsafe fn configure_llvm(sess: &Session) { add("-wasm-enable-eh", false); } - if sess.target.os == Os::Emscripten - && !sess.opts.unstable_opts.emscripten_wasm_eh - && sess.panic_strategy().unwinds() - { - add("-enable-emscripten-cxx-exceptions", false); - } - // HACK(eddyb) LLVM inserts `llvm.assume` calls to preserve align attributes // during inlining. Unfortunately these may block other optimizations. add("-preserve-alignment-assumptions-during-inlining=false", false); diff --git a/compiler/rustc_codegen_llvm/src/type_.rs b/compiler/rustc_codegen_llvm/src/type_.rs index 796f3d9ef60ba..0d49971f52533 100644 --- a/compiler/rustc_codegen_llvm/src/type_.rs +++ b/compiler/rustc_codegen_llvm/src/type_.rs @@ -106,10 +106,6 @@ impl<'ll, CX: Borrow>> GenericCx<'ll, CX> { } } impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> { - pub(crate) fn type_bool(&self) -> &'ll Type { - self.type_i8() - } - pub(crate) fn type_int_from_ty(&self, t: ty::IntTy) -> &'ll Type { match t { ty::IntTy::Isize => self.type_isize(), diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index d54f9141d8225..c0308fecf0d93 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -2774,13 +2774,7 @@ fn add_order_independent_options( } if sess.target.os == Os::Emscripten { - cmd.cc_arg(if sess.opts.unstable_opts.emscripten_wasm_eh { - "-fwasm-exceptions" - } else if sess.panic_strategy().unwinds() { - "-sDISABLE_EXCEPTION_CATCHING=0" - } else { - "-sDISABLE_EXCEPTION_CATCHING=1" - }); + cmd.cc_arg("-fwasm-exceptions"); } if flavor == LinkerFlavor::Llbc { diff --git a/compiler/rustc_codegen_ssa/src/base.rs b/compiler/rustc_codegen_ssa/src/base.rs index 78bc07869895a..bc4c2aef8da67 100644 --- a/compiler/rustc_codegen_ssa/src/base.rs +++ b/compiler/rustc_codegen_ssa/src/base.rs @@ -373,7 +373,6 @@ pub(crate) fn build_shift_expr_rhs<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( // us pub fn wants_wasm_eh(sess: &Session) -> bool { sess.target.is_like_wasm - && (sess.target.os != Os::Emscripten || sess.opts.unstable_opts.emscripten_wasm_eh) } /// Returns `true` if this session's target will use SEH-based unwinding. diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index 673ac38a1d338..72919028f1ce9 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -32,7 +32,6 @@ const GATED_CFGS: &[GatedCfg] = &[ (sym::sanitizer_cfi_normalize_integers, sym::cfg_sanitizer_cfi, Features::cfg_sanitizer_cfi), // this is consistent with naming of the compiler flag it's for (sym::fmt_debug, sym::fmt_debug, Features::fmt_debug), - (sym::emscripten_wasm_eh, sym::cfg_emscripten_wasm_eh, Features::cfg_emscripten_wasm_eh), ( sym::target_has_reliable_f16, sym::cfg_target_has_reliable_f16_f128, diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index 388482209cf9e..3040d016195d5 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -250,8 +250,6 @@ declare_features! ( (internal, allow_internal_unstable, "1.0.0", None), /// Allows using anonymous lifetimes in argument-position impl-trait. (unstable, anonymous_lifetime_in_impl_trait, "1.63.0", None), - /// Allows access to the emscripten_wasm_eh config, used by panic_unwind and unwind - (internal, cfg_emscripten_wasm_eh, "1.86.0", None), /// Allows checking whether or not the backend correctly supports unstable float types. (internal, cfg_target_has_reliable_f16_f128, "1.88.0", None), /// Allows identifying the `compiler_builtins` crate. diff --git a/compiler/rustc_hir/src/lang_items.rs b/compiler/rustc_hir/src/lang_items.rs index 4a3615e5421fe..2069b746b5a7f 100644 --- a/compiler/rustc_hir/src/lang_items.rs +++ b/compiler/rustc_hir/src/lang_items.rs @@ -332,7 +332,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; // Profiling markers for move/copy operations (used by -Z annotate-moves) CompilerMove, sym::compiler_move, compiler_move_fn, Target::Fn, GenericRequirement::Exact(2); diff --git a/compiler/rustc_hir/src/weak_lang_items.rs b/compiler/rustc_hir/src/weak_lang_items.rs index b4e548effd46d..85b0e3958c2d6 100644 --- a/compiler/rustc_hir/src/weak_lang_items.rs +++ b/compiler/rustc_hir/src/weak_lang_items.rs @@ -26,5 +26,4 @@ macro_rules! weak_lang_items { weak_lang_items! { PanicImpl, rust_begin_unwind; EhPersonality, rust_eh_personality; - EhCatchTypeinfo, rust_eh_catch_typeinfo; } diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index 0498d835df5f5..fc124348a202c 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -791,7 +791,6 @@ fn test_unstable_options_tracking_hash() { tracked!(dwarf_version, Some(5)); tracked!(embed_metadata, false); tracked!(embed_source, true); - tracked!(emscripten_wasm_eh, false); tracked!(export_executable_symbols, true); tracked!(fewer_names, Some(true)); tracked!(fixed_x18, true); diff --git a/compiler/rustc_middle/src/middle/lang_items.rs b/compiler/rustc_middle/src/middle/lang_items.rs index 8a2595e2938b8..07153d688d477 100644 --- a/compiler/rustc_middle/src/middle/lang_items.rs +++ b/compiler/rustc_middle/src/middle/lang_items.rs @@ -109,13 +109,11 @@ impl<'tcx> TyCtxt<'tcx> { /// the case of panic=abort. In these situations some lang items are injected by /// crates and don't actually need to be defined in libstd. pub fn required(tcx: TyCtxt<'_>, lang_item: LangItem) -> bool { - // If we're not compiling with unwinding, we won't actually need these - // symbols. Other panic runtimes ensure that the relevant symbols are + // If we're not compiling with unwinding, we won't actually need this + // symbol. 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, PanicStrategy::ImmediateAbort => false, } diff --git a/compiler/rustc_passes/src/weak_lang_items.rs b/compiler/rustc_passes/src/weak_lang_items.rs index 4200003ea1d1a..2d5eee183aec4 100644 --- a/compiler/rustc_passes/src/weak_lang_items.rs +++ b/compiler/rustc_passes/src/weak_lang_items.rs @@ -8,7 +8,6 @@ use rustc_hir::weak_lang_items::WEAK_LANG_ITEMS; use rustc_middle::middle::lang_items::required; use rustc_middle::ty::TyCtxt; use rustc_session::config::CrateType; -use rustc_target::spec::Os; use crate::errors::{ MissingLangItem, MissingPanicHandler, PanicUnwindWithoutStd, UnknownExternLangItem, @@ -22,18 +21,12 @@ pub(crate) fn check_crate( items: &mut lang_items::LanguageItems, krate: &ast::Crate, ) { - // These are never called by user code, they're generated by the compiler. - // They will never implicitly be added to the `missing` array unless we do - // so here. + // This is never called by user code, it's generated by the compiler. It + // will never implicitly be added to the `missing` array unless we do so + // here. if items.eh_personality().is_none() { items.missing.push(LangItem::EhPersonality); } - if tcx.sess.target.os == Os::Emscripten - && items.eh_catch_typeinfo().is_none() - && !tcx.sess.opts.unstable_opts.emscripten_wasm_eh - { - items.missing.push(LangItem::EhCatchTypeinfo); - } visit::Visitor::visit_crate(&mut WeakLangItemVisitor { tcx, items }, krate); diff --git a/compiler/rustc_session/src/config/cfg.rs b/compiler/rustc_session/src/config/cfg.rs index d16ab59a02d9e..cd301bea4eebf 100644 --- a/compiler/rustc_session/src/config/cfg.rs +++ b/compiler/rustc_session/src/config/cfg.rs @@ -157,7 +157,6 @@ pub(crate) fn disallow_cfgs(sess: &Session, user_cfgs: &Cfg) { | (sym::target_has_reliable_f128_math, None | Some(_)) | (sym::target_thread_local, None) => disallow(cfg, "--target"), (sym::fmt_debug, None | Some(_)) => disallow(cfg, "-Z fmt-debug"), - (sym::emscripten_wasm_eh, None | Some(_)) => disallow(cfg, "-Z emscripten_wasm_eh"), _ => {} } } @@ -322,11 +321,6 @@ pub(crate) fn default_configuration(sess: &Session) -> Cfg { ins_none!(sym::ub_checks); } - // Nightly-only implementation detail for the `panic_unwind` and `unwind` crates. - if sess.is_nightly_build() && sess.opts.unstable_opts.emscripten_wasm_eh { - ins_none!(sym::emscripten_wasm_eh); - } - if sess.contract_checks() { ins_none!(sym::contract_checks); } diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index de606458d048e..57db7a3eba3b7 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -2315,8 +2315,6 @@ options! { "embed source text in DWARF debug sections (default: no)"), emit_stack_sizes: bool = (false, parse_bool, [UNTRACKED], "emit a section containing stack size metadata (default: no)"), - emscripten_wasm_eh: bool = (true, parse_bool, [TRACKED], - "Use WebAssembly error handling for wasm32-unknown-emscripten"), enforce_type_length_limit: bool = (false, parse_bool, [TRACKED], "enforce the type length limit when monomorphizing instances in codegen"), experimental_default_bounds: bool = (false, parse_bool, [TRACKED], diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 7263680c302f1..cf295142d36b1 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -577,7 +577,6 @@ symbols! { cfg_boolean_literals, cfg_contract_checks, cfg_doctest, - cfg_emscripten_wasm_eh, cfg_eval, cfg_overflow_checks, cfg_panic, @@ -854,7 +853,6 @@ symbols! { edition_panic, effective_target_features, effects, - eh_catch_typeinfo, eh_personality, eii, eii_declaration, @@ -871,7 +869,6 @@ symbols! { // to be detected if it accidentally does get used. empty: "", empty_braces: "{}", - emscripten_wasm_eh, enable, end, entry_nops, @@ -1701,7 +1698,6 @@ symbols! { rust_analyzer, rust_begin_unwind, rust_cold_cc, - rust_eh_catch_typeinfo, rust_eh_personality, rust_future, rust_logo, diff --git a/library/panic_abort/src/lib.rs b/library/panic_abort/src/lib.rs index d1706b6525295..e62d758e9e5d1 100644 --- a/library/panic_abort/src/lib.rs +++ b/library/panic_abort/src/lib.rs @@ -49,46 +49,3 @@ pub unsafe fn __rust_start_panic(_payload: &mut dyn PanicPayload) -> u32 { __rust_abort() } - -// This... is a bit of an oddity. The tl;dr; is that this is required to link -// correctly, the longer explanation is below. -// -// Right now the binaries of core/std that we ship are all compiled with -// `-C panic=unwind`. This is done to ensure that the binaries are maximally -// compatible with as many situations as possible. The compiler, however, -// requires a "personality function" for all functions compiled with `-C -// panic=unwind`. This personality function is hardcoded to the symbol -// `rust_eh_personality` and is defined by the `eh_personality` lang item. -// -// So... why not just define that lang item here? Good question! The way that -// panic runtimes are linked in is actually a little subtle in that they're -// "sort of" in the compiler's crate store, but only actually linked if another -// isn't actually linked. This ends up meaning that both this crate and the -// panic_unwind crate can appear in the compiler's crate store, and if both -// define the `eh_personality` lang item then that'll hit an error. -// -// To handle this the compiler only requires the `eh_personality` is defined if -// the panic runtime being linked in is the unwinding runtime, and otherwise -// it's not required to be defined (rightfully so). In this case, however, this -// library just defines this symbol so there's at least some personality -// somewhere. -// -// Essentially this symbol is just defined to get wired up to core/std -// binaries, but it should never be called as we don't link in an unwinding -// runtime at all. -pub mod personalities { - // In the past this module used to contain stubs for the personality - // functions of various platforms, but these where removed when personality - // functions were moved to std. - - // 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]; -} diff --git a/library/panic_unwind/Cargo.toml b/library/panic_unwind/Cargo.toml index 67fc919c42c2b..72c1041b46795 100644 --- a/library/panic_unwind/Cargo.toml +++ b/library/panic_unwind/Cargo.toml @@ -18,7 +18,3 @@ unwind = { path = "../unwind" } [target.'cfg(not(all(windows, target_env = "msvc")))'.dependencies] libc = { version = "0.2", default-features = false } - -[lints.rust.unexpected_cfgs] -level = "warn" -check-cfg = ['cfg(emscripten_wasm_eh)'] diff --git a/library/panic_unwind/src/emcc.rs b/library/panic_unwind/src/emcc.rs deleted file mode 100644 index bad795a019c9a..0000000000000 --- a/library/panic_unwind/src/emcc.rs +++ /dev/null @@ -1,135 +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::sync::atomic::{AtomicBool, Ordering}; -use core::{intrinsics, ptr}; - -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 {} - -unsafe 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(), -}; - -// NOTE(nbdd0121): The `canary` field is part of stable ABI. -#[repr(C)] -struct Exception { - // See `gcc.rs` on why this is present. We already have a static here so just use it. - canary: *const TypeInfo, - - // 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(crate) 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, - } - unsafe { - let catch_data = &*(ptr as *mut CatchData); - - let adjusted_ptr = __cxa_begin_catch(catch_data.ptr as *mut libc::c_void) as *mut Exception; - if !catch_data.is_rust_panic { - super::__rust_foreign_exception(); - } - - let canary = (&raw const (*adjusted_ptr).canary).read(); - if !ptr::eq(canary, &EXCEPTION_TYPE_INFO) { - super::__rust_foreign_exception(); - } - - let was_caught = (*adjusted_ptr).caught.swap(true, Ordering::Relaxed); - if was_caught { - // Since cleanup() isn't allowed to panic, we just abort instead. - intrinsics::abort(); - } - let out = (*adjusted_ptr).data.take().unwrap(); - __cxa_end_catch(); - out - } -} - -pub(crate) unsafe fn panic(data: Box) -> u32 { - unsafe { - let exception = __cxa_allocate_exception(size_of::()) as *mut Exception; - if exception.is_null() { - return uw::_URC_FATAL_PHASE1_ERROR as u32; - } - ptr::write( - exception, - Exception { - canary: &EXCEPTION_TYPE_INFO, - 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 - } -} - -unsafe 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 fc0a627d293f3..9d204a150dd45 100644 --- a/library/panic_unwind/src/lib.rs +++ b/library/panic_unwind/src/lib.rs @@ -2,11 +2,12 @@ //! //! This crate is an implementation of panics in Rust using "most native" stack //! unwinding mechanism of the platform this is being compiled for. This -//! essentially gets categorized into three buckets currently: +//! essentially gets categorized into four 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. +//! 1. When running inside miri, MSVC targets use Miri intrinsics in the `miri.rs` file. +//! 2. MSVC targets use SEH in the `seh.rs` file. +//! 3. Some targets use an aborting implementation in the `dummy.rs` or `hermit.rs` files. +//! 4. All other targets use libunwind/libgcc in the `gcc.rs` file. //! //! More documentation about each implementation can be found in the respective //! module. @@ -14,8 +15,6 @@ #![no_std] #![unstable(feature = "panic_unwind", issue = "32837")] #![doc(issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/")] -#![cfg_attr(all(target_os = "emscripten", not(emscripten_wasm_eh)), feature(lang_items))] -#![feature(cfg_emscripten_wasm_eh)] #![feature(core_intrinsics)] #![feature(panic_unwind)] #![feature(staged_api)] @@ -33,10 +32,6 @@ use core::any::Any; use core::panic::PanicPayload; cfg_select! { - all(target_os = "emscripten", not(emscripten_wasm_eh)) => { - #[path = "emcc.rs"] - mod imp; - } target_os = "hermit" => { #[path = "hermit.rs"] mod imp; diff --git a/library/unwind/Cargo.toml b/library/unwind/Cargo.toml index f02744a107082..1293c469d11c1 100644 --- a/library/unwind/Cargo.toml +++ b/library/unwind/Cargo.toml @@ -35,4 +35,4 @@ system-llvm-libunwind = [] [lints.rust.unexpected_cfgs] level = "warn" -check-cfg = ['cfg(emscripten_wasm_eh)', 'cfg(target_arch, values("loongarch32"))'] +check-cfg = ['cfg(target_arch, values("loongarch32"))'] diff --git a/library/unwind/src/lib.rs b/library/unwind/src/lib.rs index 22568d5f6f1f9..4e380d8894781 100644 --- a/library/unwind/src/lib.rs +++ b/library/unwind/src/lib.rs @@ -1,10 +1,9 @@ #![no_std] #![unstable(feature = "panic_unwind", issue = "32837")] -#![feature(cfg_emscripten_wasm_eh)] #![feature(link_cfg)] #![feature(staged_api)] #![cfg_attr( - all(target_family = "wasm", any(not(target_os = "emscripten"), emscripten_wasm_eh)), + target_family = "wasm", feature(link_llvm_intrinsics, simd_wasm64, asm_experimental_arch) )] #![allow(internal_features)] diff --git a/src/doc/rustc/src/platform-support/wasm32-unknown-emscripten.md b/src/doc/rustc/src/platform-support/wasm32-unknown-emscripten.md index d5e3125fd3c79..0d15097468b17 100644 --- a/src/doc/rustc/src/platform-support/wasm32-unknown-emscripten.md +++ b/src/doc/rustc/src/platform-support/wasm32-unknown-emscripten.md @@ -160,8 +160,7 @@ which features are enabled. Note that Rust code compiled for `wasm32-unknown-emscripten` currently enables `-fwasm-exceptions` (legacy WASM exceptions) by default unless the Rust code is -compiled with `-Cpanic=abort`. It is possible to use JS exceptions by passing -the flag ``-Z emscripten-wasm-eh=false`` but this will be removed in the future. +compiled with `-Cpanic=abort`. Please refer to the [Emscripten ABI compatibility](#emscripten-abi-compatibility) section to ensure that the features that are enabled do not cause an ABI mismatch diff --git a/src/doc/unstable-book/src/compiler-flags/emscripten-wasm-eh.md b/src/doc/unstable-book/src/compiler-flags/emscripten-wasm-eh.md deleted file mode 100644 index eab29a1744b67..0000000000000 --- a/src/doc/unstable-book/src/compiler-flags/emscripten-wasm-eh.md +++ /dev/null @@ -1,6 +0,0 @@ -# `emscripten-wasm-eh` - -Use the WebAssembly exception handling ABI to unwind for the -`wasm32-unknown-emscripten`. If compiling with this setting, the `emcc` linker -should be invoked with `-fwasm-exceptions`. If linking with C/C++ files, the -C/C++ files should also be compiled with `-fwasm-exceptions`. 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 ee4d976dfd246..deb7fbca716c3 100644 --- a/src/doc/unstable-book/src/language-features/lang-items.md +++ b/src/doc/unstable-book/src/language-features/lang-items.md @@ -27,8 +27,7 @@ Some features provided by lang items: failure mechanisms of the compiler. This is often mapped to GCC's personality function (see the [`std` implementation][personality] for more information), but programs which don't trigger a panic can be assured that this function is - never called. Additionally, a `eh_catch_typeinfo` static is needed for certain - targets which implement Rust panics on top of C++ exceptions. + never called. - the traits in `core::marker` used to indicate types of various kinds; e.g. lang items `sized`, `sync` and `copy`. - memory allocation, see below. diff --git a/tests/codegen-llvm/emscripten-catch-unwind-js-eh.rs b/tests/codegen-llvm/emscripten-catch-unwind-js-eh.rs deleted file mode 100644 index 4f62d3e56a787..0000000000000 --- a/tests/codegen-llvm/emscripten-catch-unwind-js-eh.rs +++ /dev/null @@ -1,71 +0,0 @@ -//@ compile-flags: -Copt-level=3 --target wasm32-unknown-emscripten -Z emscripten-wasm-eh=false -//@ needs-llvm-components: webassembly - -// Emscripten has its own unique implementation of catch_unwind (in `codegen_emcc_try`), -// make sure it generates something reasonable. - -#![feature(no_core, lang_items, intrinsics, rustc_attrs)] -#![crate_type = "lib"] -#![no_std] -#![no_core] - -#[lang = "pointee_sized"] -pub trait PointeeSized {} - -#[lang = "meta_sized"] -pub trait MetaSized: PointeeSized {} - -#[lang = "sized"] -pub trait Sized: MetaSized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} - -impl Copy for *mut T {} - -#[rustc_intrinsic] -const fn size_of() -> usize { - loop {} -} - -#[rustc_intrinsic] -unsafe fn catch_unwind( - try_fn: unsafe fn(_: *mut Data), - data: *mut Data, - catch_fn: unsafe fn(_: *mut Data, _: *mut u8), -) -> bool; - -// CHECK-LABEL: @ptr_size -#[no_mangle] -pub fn ptr_size() -> usize { - // CHECK: ret [[PTR_SIZE:.*]] - const { size_of::<*mut u8>() } -} - -// CHECK-LABEL: @test_catch_unwind -#[no_mangle] -pub unsafe fn test_catch_unwind( - try_fn: unsafe fn(_: *mut u8), - data: *mut u8, - catch_fn: unsafe fn(_: *mut u8, _: *mut u8), -) -> bool { - // CHECK: start: - // CHECK: [[ALLOCA:%.*]] = alloca - - // CHECK: catch.i: - // CHECK: [[LANDINGPAD:%.*]] = landingpad - // CHECK: [[EXCEPTION:%.*]] = extractvalue {{.*}} [[LANDINGPAD]], 0 - // CHECK: [[SELECTOR:%.*]] = extractvalue {{.*}} [[LANDINGPAD]], 1 - - // CHECK: [[IS_RUST_EXN:%.*]] = icmp eq {{.*}}[[SELECTOR]] - // CHECK: [[IS_RUST_EXN_I8:%.*]] = zext i1 [[IS_RUST_EXN]] to i8 - - // CHECK: store ptr [[EXCEPTION]], ptr [[ALLOCA]] - // CHECK: [[IS_RUST_SLOT:%.*]] = getelementptr inbounds{{( nuw)?}} i8, ptr [[ALLOCA]], [[PTR_SIZE]] - // CHECK: store i8 [[IS_RUST_EXN_I8]], ptr [[IS_RUST_SLOT]] - - // CHECK: call void %catch_fn(ptr %data, ptr nonnull [[ALLOCA]]) - - catch_unwind(try_fn, data, catch_fn) -} diff --git a/tests/codegen-llvm/emscripten-catch-unwind-wasm-eh.rs b/tests/codegen-llvm/emscripten-catch-unwind.rs similarity index 96% rename from tests/codegen-llvm/emscripten-catch-unwind-wasm-eh.rs rename to tests/codegen-llvm/emscripten-catch-unwind.rs index 25ac3181ba3b2..b3af16c4ed0ee 100644 --- a/tests/codegen-llvm/emscripten-catch-unwind-wasm-eh.rs +++ b/tests/codegen-llvm/emscripten-catch-unwind.rs @@ -1,7 +1,7 @@ -//@ compile-flags: -Copt-level=3 --target wasm32-unknown-emscripten -Z emscripten-wasm-eh +//@ compile-flags: -Copt-level=3 --target wasm32-unknown-emscripten //@ needs-llvm-components: webassembly -// Emscripten catch_unwind using wasm exceptions +// Emscripten catch_unwind #![feature(no_core, lang_items, intrinsics, rustc_attrs)] #![crate_type = "lib"] diff --git a/tests/codegen-llvm/terminating-catchpad.rs b/tests/codegen-llvm/terminating-catchpad.rs index 7c98ea94fdc13..cea5d48ab99e5 100644 --- a/tests/codegen-llvm/terminating-catchpad.rs +++ b/tests/codegen-llvm/terminating-catchpad.rs @@ -1,5 +1,5 @@ //@ revisions: emscripten wasi seh -//@[emscripten] compile-flags: --target wasm32-unknown-emscripten -Z emscripten-wasm-eh +//@[emscripten] compile-flags: --target wasm32-unknown-emscripten //@[wasi] compile-flags: --target wasm32-wasip1 -C panic=unwind //@[seh] compile-flags: --target x86_64-pc-windows-msvc //@[emscripten] needs-llvm-components: webassembly diff --git a/tests/codegen-llvm/wasm_exceptions.rs b/tests/codegen-llvm/wasm_exceptions.rs index 48c9c0b50e3fb..b4c024e4ed0e6 100644 --- a/tests/codegen-llvm/wasm_exceptions.rs +++ b/tests/codegen-llvm/wasm_exceptions.rs @@ -1,6 +1,6 @@ //@ only-wasm32 //@ revisions: WASM WASMEXN -//@ [WASMEXN] compile-flags: -C panic=unwind -Z emscripten-wasm-eh +//@ [WASMEXN] compile-flags: -C panic=unwind #![crate_type = "lib"] #![feature(core_intrinsics, link_llvm_intrinsics)] diff --git a/tests/ui/cfg/disallowed-cli-cfgs.emscripten_wasm_eh_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.emscripten_wasm_eh_.stderr deleted file mode 100644 index 8b2ee0e5c0c3d..0000000000000 --- a/tests/ui/cfg/disallowed-cli-cfgs.emscripten_wasm_eh_.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: unexpected `--cfg emscripten_wasm_eh` flag - | - = note: config `emscripten_wasm_eh` is only supposed to be controlled by `-Z emscripten_wasm_eh` - = note: manually setting a built-in cfg can and does create incoherent behaviors - = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default - -error: aborting due to 1 previous error - diff --git a/tests/ui/cfg/disallowed-cli-cfgs.rs b/tests/ui/cfg/disallowed-cli-cfgs.rs index 81f3d9313ef1f..57aed0016e971 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.rs +++ b/tests/ui/cfg/disallowed-cli-cfgs.rs @@ -9,7 +9,6 @@ //@ revisions: target_has_atomic_ target_has_atomic_primitive_alignment_ //@ revisions: target_has_atomic_load_store_ target_thread_local_ relocation_model_ //@ revisions: fmt_debug_ -//@ revisions: emscripten_wasm_eh_ //@ revisions: reliable_f16_ reliable_f16_math_ reliable_f128_ reliable_f128_math_ //@ [overflow_checks_]compile-flags: --cfg overflow_checks @@ -38,7 +37,6 @@ //@ [target_thread_local_]compile-flags: --cfg target_thread_local //@ [relocation_model_]compile-flags: --cfg relocation_model="a" //@ [fmt_debug_]compile-flags: --cfg fmt_debug="shallow" -//@ [emscripten_wasm_eh_]compile-flags: --cfg emscripten_wasm_eh //@ [reliable_f16_]compile-flags: --cfg target_has_reliable_f16 //@ [reliable_f16_math_]compile-flags: --cfg target_has_reliable_f16_math //@ [reliable_f128_]compile-flags: --cfg target_has_reliable_f128 diff --git a/tests/ui/consts/const-eval/const_panic_libcore_bin.rs b/tests/ui/consts/const-eval/const_panic_libcore_bin.rs index 90ae5165d233b..d6fbdb28d56a2 100644 --- a/tests/ui/consts/const-eval/const_panic_libcore_bin.rs +++ b/tests/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/tests/ui/extern-flag/empty-extern-arg.rs b/tests/ui/extern-flag/empty-extern-arg.rs index 10cc3be71135e..d57edc6041247 100644 --- a/tests/ui/extern-flag/empty-extern-arg.rs +++ b/tests/ui/extern-flag/empty-extern-arg.rs @@ -2,7 +2,6 @@ //~^ ERROR cannot resolve a prelude import //@ compile-flags: --extern std= //@ needs-unwind since it affects the error output -//@ ignore-emscripten missing eh_catch_typeinfo lang item fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-cfg-emscripten-wasm-eh.rs b/tests/ui/feature-gates/feature-gate-cfg-emscripten-wasm-eh.rs deleted file mode 100644 index a13e7fa317f5b..0000000000000 --- a/tests/ui/feature-gates/feature-gate-cfg-emscripten-wasm-eh.rs +++ /dev/null @@ -1,4 +0,0 @@ -//@ compile-flags: --check-cfg=cfg(emscripten_wasm_eh) -#[cfg(emscripten_wasm_eh)] -//~^ ERROR `cfg(emscripten_wasm_eh)` is experimental -fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-cfg-emscripten-wasm-eh.stderr b/tests/ui/feature-gates/feature-gate-cfg-emscripten-wasm-eh.stderr deleted file mode 100644 index a829c9b93a566..0000000000000 --- a/tests/ui/feature-gates/feature-gate-cfg-emscripten-wasm-eh.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0658]: `cfg(emscripten_wasm_eh)` is experimental and subject to change - --> $DIR/feature-gate-cfg-emscripten-wasm-eh.rs:2:7 - | -LL | #[cfg(emscripten_wasm_eh)] - | ^^^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(cfg_emscripten_wasm_eh)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/macros/macro-comma-behavior.core.stderr b/tests/ui/macros/macro-comma-behavior.core.stderr index ac15e9fa8ea83..e84a33d1f8dee 100644 --- a/tests/ui/macros/macro-comma-behavior.core.stderr +++ b/tests/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/tests/ui/macros/macro-comma-behavior.rs b/tests/ui/macros/macro-comma-behavior.rs index ea75fdd6842e1..5085f3c9cf83c 100644 --- a/tests/ui/macros/macro-comma-behavior.rs +++ b/tests/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)] #[panic_handler] fn panic_impl(panic: &core::panic::PanicInfo) -> ! { loop {} } // (see documentation of the similarly-named test in run-pass) diff --git a/tests/ui/macros/macro-comma-behavior.std.stderr b/tests/ui/macros/macro-comma-behavior.std.stderr index 7fd060e222498..e29737e0522a4 100644 --- a/tests/ui/macros/macro-comma-behavior.std.stderr +++ b/tests/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/tests/ui/panic-handler/weak-lang-item.rs b/tests/ui/panic-handler/weak-lang-item.rs index a8f7aadf6c722..43a235fd6b418 100644 --- a/tests/ui/panic-handler/weak-lang-item.rs +++ b/tests/ui/panic-handler/weak-lang-item.rs @@ -1,7 +1,6 @@ //@ edition:2015 //@ aux-build:weak-lang-items.rs //@ needs-unwind since it affects the error output -//@ ignore-emscripten missing eh_catch_typeinfo lang item #![no_std] diff --git a/tests/ui/panic-handler/weak-lang-item.stderr b/tests/ui/panic-handler/weak-lang-item.stderr index eb5f4ad56ea31..5acd3e3187051 100644 --- a/tests/ui/panic-handler/weak-lang-item.stderr +++ b/tests/ui/panic-handler/weak-lang-item.stderr @@ -1,5 +1,5 @@ error[E0259]: the name `core` is defined multiple times - --> $DIR/weak-lang-item.rs:8:1 + --> $DIR/weak-lang-item.rs:7:1 | LL | extern crate core; | ^^^^^^^^^^^^^^^^^^ `core` reimported here diff --git a/tests/ui/panic-runtime/auxiliary/panic-runtime-lang-items.rs b/tests/ui/panic-runtime/auxiliary/panic-runtime-lang-items.rs index 44137b85748fa..1a4346a410b47 100644 --- a/tests/ui/panic-runtime/auxiliary/panic-runtime-lang-items.rs +++ b/tests/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/tests/ui/range/issue-54505-no-std.rs b/tests/ui/range/issue-54505-no-std.rs index 0c913f766b709..6ddfc7e231464 100644 --- a/tests/ui/range/issue-54505-no-std.rs +++ b/tests/ui/range/issue-54505-no-std.rs @@ -12,9 +12,6 @@ use core::ops::RangeBounds; #[cfg(any(not(target_arch = "wasm32"), target_os = "emscripten"))] #[lang = "eh_personality"] extern "C" fn eh_personality() {} -#[cfg(target_os = "emscripten")] -#[lang = "eh_catch_typeinfo"] -static EH_CATCH_TYPEINFO: u8 = 0; #[panic_handler] fn panic_handler(_: &core::panic::PanicInfo) -> ! { diff --git a/tests/ui/range/issue-54505-no-std.stderr b/tests/ui/range/issue-54505-no-std.stderr index 866a82afb7e2f..456f9454e5404 100644 --- a/tests/ui/range/issue-54505-no-std.stderr +++ b/tests/ui/range/issue-54505-no-std.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-54505-no-std.rs:29:16 + --> $DIR/issue-54505-no-std.rs:26:16 | LL | take_range(0..1); | ---------- ^^^^ expected `&_`, found `Range<{integer}>` @@ -9,7 +9,7 @@ LL | take_range(0..1); = note: expected reference `&_` found struct `core::ops::Range<{integer}>` note: function defined here - --> $DIR/issue-54505-no-std.rs:25:4 + --> $DIR/issue-54505-no-std.rs:22:4 | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- @@ -19,7 +19,7 @@ LL | take_range(&(0..1)); | ++ + error[E0308]: mismatched types - --> $DIR/issue-54505-no-std.rs:34:16 + --> $DIR/issue-54505-no-std.rs:31:16 | LL | take_range(1..); | ---------- ^^^ expected `&_`, found `RangeFrom<{integer}>` @@ -29,7 +29,7 @@ LL | take_range(1..); = note: expected reference `&_` found struct `core::ops::RangeFrom<{integer}>` note: function defined here - --> $DIR/issue-54505-no-std.rs:25:4 + --> $DIR/issue-54505-no-std.rs:22:4 | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- @@ -39,7 +39,7 @@ LL | take_range(&(1..)); | ++ + error[E0308]: mismatched types - --> $DIR/issue-54505-no-std.rs:39:16 + --> $DIR/issue-54505-no-std.rs:36:16 | LL | take_range(..); | ---------- ^^ expected `&_`, found `RangeFull` @@ -49,12 +49,12 @@ LL | take_range(..); = note: expected reference `&_` found struct `RangeFull` note: function defined here - --> $DIR/issue-54505-no-std.rs:25:4 + --> $DIR/issue-54505-no-std.rs:22:4 | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- help: you might have meant to use `..` to skip providing a value for expected fields, but this is only supported on non-tuple struct literals when `#![feature(default_field_values)]` is enabled; it is instead interpreted as a `std::ops::RangeFull` literal - --> $DIR/issue-54505-no-std.rs:39:16 + --> $DIR/issue-54505-no-std.rs:36:16 | LL | take_range(..); | ^^ @@ -64,7 +64,7 @@ LL | take_range(&(..)); | ++ + error[E0308]: mismatched types - --> $DIR/issue-54505-no-std.rs:45:16 + --> $DIR/issue-54505-no-std.rs:42:16 | LL | take_range(0..=1); | ---------- ^^^^^ expected `&_`, found `RangeInclusive<{integer}>` @@ -74,7 +74,7 @@ LL | take_range(0..=1); = note: expected reference `&_` found struct `core::ops::RangeInclusive<{integer}>` note: function defined here - --> $DIR/issue-54505-no-std.rs:25:4 + --> $DIR/issue-54505-no-std.rs:22:4 | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- @@ -84,7 +84,7 @@ LL | take_range(&(0..=1)); | ++ + error[E0308]: mismatched types - --> $DIR/issue-54505-no-std.rs:50:16 + --> $DIR/issue-54505-no-std.rs:47:16 | LL | take_range(..5); | ---------- ^^^ expected `&_`, found `RangeTo<{integer}>` @@ -94,7 +94,7 @@ LL | take_range(..5); = note: expected reference `&_` found struct `RangeTo<{integer}>` note: function defined here - --> $DIR/issue-54505-no-std.rs:25:4 + --> $DIR/issue-54505-no-std.rs:22:4 | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- @@ -104,7 +104,7 @@ LL | take_range(&(..5)); | ++ + error[E0308]: mismatched types - --> $DIR/issue-54505-no-std.rs:55:16 + --> $DIR/issue-54505-no-std.rs:52:16 | LL | take_range(..=42); | ---------- ^^^^^ expected `&_`, found `RangeToInclusive<{integer}>` @@ -114,7 +114,7 @@ LL | take_range(..=42); = note: expected reference `&_` found struct `core::ops::RangeToInclusive<{integer}>` note: function defined here - --> $DIR/issue-54505-no-std.rs:25:4 + --> $DIR/issue-54505-no-std.rs:22:4 | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ -------------------------