Skip to content

Commit 20ca662

Browse files
committed
Auto merge of #157372 - JonathanBrouwer:rollup-T5PX0dg, r=<try>
Rollup of 9 pull requests try-job: dist-various-1 try-job: test-various try-job: x86_64-gnu-aux try-job: x86_64-gnu-llvm-21-3 try-job: x86_64-msvc-1 try-job: aarch64-apple try-job: x86_64-mingw-1 try-job: i686-msvc-2
2 parents 53509ca + 5058eeb commit 20ca662

114 files changed

Lines changed: 1399 additions & 1407 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

compiler/rustc_codegen_llvm/src/context.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ use rustc_session::config::{
2626
BranchProtection, CFGuard, CFProtection, CrateType, DebugInfo, FunctionReturn, PAuthKey, PacRet,
2727
};
2828
use rustc_span::{DUMMY_SP, Span, Spanned, Symbol, sym};
29-
use rustc_symbol_mangling::mangle_internal_symbol;
3029
use rustc_target::spec::{
3130
Arch, CfgAbi, Env, FramePointer, HasTargetSpec, Os, RelocModel, SmallDataThresholdSupport,
3231
Target, TlsModel,
@@ -136,7 +135,6 @@ pub(crate) struct FullCx<'ll, 'tcx> {
136135
pub dbg_cx: Option<debuginfo::CodegenUnitDebugContext<'ll, 'tcx>>,
137136

138137
eh_personality: Cell<Option<&'ll Value>>,
139-
eh_catch_typeinfo: Cell<Option<&'ll Value>>,
140138
pub rust_try_fn: Cell<Option<(&'ll Type, &'ll Value)>>,
141139

142140
intrinsics:
@@ -672,7 +670,6 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
672670
coverage_cx,
673671
dbg_cx,
674672
eh_personality: Cell::new(None),
675-
eh_catch_typeinfo: Cell::new(None),
676673
rust_try_fn: Cell::new(None),
677674
intrinsics: Default::default(),
678675
local_gen_sym_counter: Cell::new(0),
@@ -1042,23 +1039,6 @@ impl<'ll> CodegenCx<'ll, '_> {
10421039
}
10431040
}
10441041
}
1045-
1046-
pub(crate) fn eh_catch_typeinfo(&self) -> &'ll Value {
1047-
if let Some(eh_catch_typeinfo) = self.eh_catch_typeinfo.get() {
1048-
return eh_catch_typeinfo;
1049-
}
1050-
let tcx = self.tcx;
1051-
assert!(self.sess().target.os == Os::Emscripten);
1052-
let eh_catch_typeinfo = match tcx.lang_items().eh_catch_typeinfo() {
1053-
Some(def_id) => self.get_static(def_id),
1054-
_ => {
1055-
let ty = self.type_struct(&[self.type_ptr(), self.type_ptr()], false);
1056-
self.declare_global(&mangle_internal_symbol(self.tcx, "rust_eh_catch_typeinfo"), ty)
1057-
}
1058-
};
1059-
self.eh_catch_typeinfo.set(Some(eh_catch_typeinfo));
1060-
eh_catch_typeinfo
1061-
}
10621042
}
10631043

10641044
impl CodegenCx<'_, '_> {

compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,8 @@ fn build_coroutine_variant_struct_type_di_node<'ll, 'tcx>(
328328
.map(|field_index| {
329329
let coroutine_saved_local = coroutine_layout.variant_fields[variant_index]
330330
[FieldIdx::from_usize(field_index)];
331-
let field_name_maybe = coroutine_layout.field_names[coroutine_saved_local];
331+
let field_name_maybe =
332+
coroutine_layout.field_tys[coroutine_saved_local].debuginfo_name;
332333
let field_name = field_name_maybe
333334
.as_ref()
334335
.map(|s| Cow::from(s.as_str()))

compiler/rustc_codegen_llvm/src/intrinsic.rs

Lines changed: 1 addition & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use rustc_session::lint::builtin::DEPRECATED_LLVM_INTRINSIC;
2828
use rustc_span::{ErrorGuaranteed, Span, Symbol, sym};
2929
use rustc_symbol_mangling::{mangle_internal_symbol, symbol_name_for_instance_in_crate};
3030
use rustc_target::callconv::PassMode;
31-
use rustc_target::spec::{Arch, Os};
31+
use rustc_target::spec::Arch;
3232
use tracing::debug;
3333

3434
use crate::abi::FnAbiLlvmExt;
@@ -1356,8 +1356,6 @@ fn catch_unwind_intrinsic<'ll, 'tcx>(
13561356
codegen_msvc_try(bx, try_func, data, catch_func)
13571357
} else if wants_wasm_eh(bx.sess()) {
13581358
codegen_wasm_try(bx, try_func, data, catch_func)
1359-
} else if bx.sess().target.os == Os::Emscripten {
1360-
codegen_emcc_try(bx, try_func, data, catch_func)
13611359
} else {
13621360
codegen_gnu_try(bx, try_func, data, catch_func)
13631361
}
@@ -1654,87 +1652,6 @@ fn codegen_gnu_try<'ll, 'tcx>(
16541652
ret
16551653
}
16561654

1657-
// Variant of codegen_gnu_try used for emscripten where Rust panics are
1658-
// implemented using C++ exceptions. Here we use exceptions of a specific type
1659-
// (`struct rust_panic`) to represent Rust panics.
1660-
fn codegen_emcc_try<'ll, 'tcx>(
1661-
bx: &mut Builder<'_, 'll, 'tcx>,
1662-
try_func: &'ll Value,
1663-
data: &'ll Value,
1664-
catch_func: &'ll Value,
1665-
) -> &'ll Value {
1666-
let (llty, llfn) = get_rust_try_fn(bx, &mut |mut bx| {
1667-
// Codegens the shims described above:
1668-
//
1669-
// bx:
1670-
// invoke %try_func(%data) normal %normal unwind %catch
1671-
//
1672-
// normal:
1673-
// ret 0
1674-
//
1675-
// catch:
1676-
// (%ptr, %selector) = landingpad
1677-
// %rust_typeid = @llvm.eh.typeid.for(@_ZTI10rust_panic)
1678-
// %is_rust_panic = %selector == %rust_typeid
1679-
// %catch_data = alloca { i8*, i8 }
1680-
// %catch_data[0] = %ptr
1681-
// %catch_data[1] = %is_rust_panic
1682-
// call %catch_func(%data, %catch_data)
1683-
// ret 1
1684-
let then = bx.append_sibling_block("then");
1685-
let catch = bx.append_sibling_block("catch");
1686-
1687-
let try_func = llvm::get_param(bx.llfn(), 0);
1688-
let data = llvm::get_param(bx.llfn(), 1);
1689-
let catch_func = llvm::get_param(bx.llfn(), 2);
1690-
let try_func_ty = bx.type_func(&[bx.type_ptr()], bx.type_void());
1691-
bx.invoke(try_func_ty, None, None, try_func, &[data], then, catch, None, None);
1692-
1693-
bx.switch_to_block(then);
1694-
bx.ret(bx.const_bool(false));
1695-
1696-
// Type indicator for the exception being thrown.
1697-
//
1698-
// The first value in this tuple is a pointer to the exception object
1699-
// being thrown. The second value is a "selector" indicating which of
1700-
// the landing pad clauses the exception's type had been matched to.
1701-
bx.switch_to_block(catch);
1702-
let tydesc = bx.eh_catch_typeinfo();
1703-
let lpad_ty = bx.type_struct(&[bx.type_ptr(), bx.type_i32()], false);
1704-
let vals = bx.landing_pad(lpad_ty, bx.eh_personality(), 2);
1705-
bx.add_clause(vals, tydesc);
1706-
bx.add_clause(vals, bx.const_null(bx.type_ptr()));
1707-
let ptr = bx.extract_value(vals, 0);
1708-
let selector = bx.extract_value(vals, 1);
1709-
1710-
// Check if the typeid we got is the one for a Rust panic.
1711-
let rust_typeid = bx.call_intrinsic("llvm.eh.typeid.for", &[bx.val_ty(tydesc)], &[tydesc]);
1712-
let is_rust_panic = bx.icmp(IntPredicate::IntEQ, selector, rust_typeid);
1713-
let is_rust_panic = bx.zext(is_rust_panic, bx.type_bool());
1714-
1715-
// We need to pass two values to catch_func (ptr and is_rust_panic), so
1716-
// create an alloca and pass a pointer to that.
1717-
let ptr_size = bx.tcx().data_layout.pointer_size();
1718-
let ptr_align = bx.tcx().data_layout.pointer_align().abi;
1719-
let i8_align = bx.tcx().data_layout.i8_align;
1720-
// Required in order for there to be no padding between the fields.
1721-
assert!(i8_align <= ptr_align);
1722-
let catch_data = bx.alloca(2 * ptr_size, ptr_align);
1723-
bx.store(ptr, catch_data, ptr_align);
1724-
let catch_data_1 = bx.inbounds_ptradd(catch_data, bx.const_usize(ptr_size.bytes()));
1725-
bx.store(is_rust_panic, catch_data_1, i8_align);
1726-
1727-
let catch_ty = bx.type_func(&[bx.type_ptr(), bx.type_ptr()], bx.type_void());
1728-
bx.call(catch_ty, None, None, catch_func, &[data, catch_data], None, None);
1729-
bx.ret(bx.const_bool(true));
1730-
});
1731-
1732-
// Note that no invoke is used here because by definition this function
1733-
// can't panic (that's what it's catching).
1734-
let ret = bx.call(llty, None, None, llfn, &[try_func, data, catch_func], None, None);
1735-
ret
1736-
}
1737-
17381655
// Helper function to give a Block to a closure to codegen a shim function.
17391656
// This is currently primarily used for the `try` intrinsic functions above.
17401657
fn gen_fn<'a, 'll, 'tcx>(

compiler/rustc_codegen_llvm/src/llvm_util.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,6 @@ unsafe fn configure_llvm(sess: &Session) {
109109
add("-wasm-enable-eh", false);
110110
}
111111

112-
if sess.target.os == Os::Emscripten
113-
&& !sess.opts.unstable_opts.emscripten_wasm_eh
114-
&& sess.panic_strategy().unwinds()
115-
{
116-
add("-enable-emscripten-cxx-exceptions", false);
117-
}
118-
119112
// HACK(eddyb) LLVM inserts `llvm.assume` calls to preserve align attributes
120113
// during inlining. Unfortunately these may block other optimizations.
121114
add("-preserve-alignment-assumptions-during-inlining=false", false);

compiler/rustc_codegen_llvm/src/type_.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,6 @@ impl<'ll, CX: Borrow<SCx<'ll>>> GenericCx<'ll, CX> {
106106
}
107107
}
108108
impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
109-
pub(crate) fn type_bool(&self) -> &'ll Type {
110-
self.type_i8()
111-
}
112-
113109
pub(crate) fn type_int_from_ty(&self, t: ty::IntTy) -> &'ll Type {
114110
match t {
115111
ty::IntTy::Isize => self.type_isize(),

compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2774,13 +2774,7 @@ fn add_order_independent_options(
27742774
}
27752775

27762776
if sess.target.os == Os::Emscripten {
2777-
cmd.cc_arg(if sess.opts.unstable_opts.emscripten_wasm_eh {
2778-
"-fwasm-exceptions"
2779-
} else if sess.panic_strategy().unwinds() {
2780-
"-sDISABLE_EXCEPTION_CATCHING=0"
2781-
} else {
2782-
"-sDISABLE_EXCEPTION_CATCHING=1"
2783-
});
2777+
cmd.cc_arg("-fwasm-exceptions");
27842778
}
27852779

27862780
if flavor == LinkerFlavor::Llbc {

compiler/rustc_codegen_ssa/src/back/write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1964,7 +1964,7 @@ impl Emitter for SharedEmitter {
19641964
assert_eq!(diag.is_lint, None);
19651965
// No sensible check for `diag.emitted_at`.
19661966

1967-
let args = mem::replace(&mut diag.args, DiagArgMap::default());
1967+
let args = mem::take(&mut diag.args);
19681968
drop(
19691969
self.sender.send(SharedEmitterMessage::Diagnostic(Diagnostic {
19701970
span: diag.span.primary_spans().iter().map(|span| span.data()).collect::<Vec<_>>(),

compiler/rustc_codegen_ssa/src/base.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,6 @@ pub(crate) fn build_shift_expr_rhs<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
373373
// us
374374
pub fn wants_wasm_eh(sess: &Session) -> bool {
375375
sess.target.is_like_wasm
376-
&& (sess.target.os != Os::Emscripten || sess.opts.unstable_opts.emscripten_wasm_eh)
377376
}
378377

379378
/// Returns `true` if this session's target will use SEH-based unwinding.

compiler/rustc_feature/src/builtin_attrs.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ const GATED_CFGS: &[GatedCfg] = &[
3232
(sym::sanitizer_cfi_normalize_integers, sym::cfg_sanitizer_cfi, Features::cfg_sanitizer_cfi),
3333
// this is consistent with naming of the compiler flag it's for
3434
(sym::fmt_debug, sym::fmt_debug, Features::fmt_debug),
35-
(sym::emscripten_wasm_eh, sym::cfg_emscripten_wasm_eh, Features::cfg_emscripten_wasm_eh),
3635
(
3736
sym::target_has_reliable_f16,
3837
sym::cfg_target_has_reliable_f16_f128,

compiler/rustc_feature/src/unstable.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,6 @@ declare_features! (
250250
(internal, allow_internal_unstable, "1.0.0", None),
251251
/// Allows using anonymous lifetimes in argument-position impl-trait.
252252
(unstable, anonymous_lifetime_in_impl_trait, "1.63.0", None),
253-
/// Allows access to the emscripten_wasm_eh config, used by panic_unwind and unwind
254-
(internal, cfg_emscripten_wasm_eh, "1.86.0", None),
255253
/// Allows checking whether or not the backend correctly supports unstable float types.
256254
(internal, cfg_target_has_reliable_f16_f128, "1.88.0", None),
257255
/// Allows identifying the `compiler_builtins` crate.

0 commit comments

Comments
 (0)