File tree Expand file tree Collapse file tree
compiler/rustc_llvm/llvm-wrapper
src/bootstrap/src/core/build_steps Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -347,7 +347,13 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
347347 // option causes bugs in the LLVM WebAssembly backend. You should be able to
348348 // remove this check when Rust's minimum supported LLVM version is >= 18
349349 // https://github.com/llvm/llvm-project/pull/65876
350- if (!Trip.isWasm ()) {
350+ //
351+ // Also keep traps after noreturn calls on Windows, because the trap is
352+ // needed to keep the return address within the calling function's
353+ // .pdata range. Without it, RtlLookupFunctionEntry resolves the wrong
354+ // function and SEH unwinding (used for backtraces) terminates early.
355+ // See https://github.com/rust-lang/rust/issues/140489
356+ if (!Trip.isWasm () && !Trip.isOSWindows ()) {
351357 Options.NoTrapAfterNoreturn = true ;
352358 }
353359 }
@@ -840,11 +846,8 @@ extern "C" LLVMRustResult LLVMRustOptimize(
840846 }
841847 break ;
842848 case LLVMRustOptStage::PreLinkThinLTO:
843- MPM = PB.buildThinLTOPreLinkDefaultPipeline (OptLevel);
844- NeedThinLTOBufferPasses = false ;
845- break ;
846849 case LLVMRustOptStage::PreLinkFatLTO:
847- MPM = PB.buildLTOPreLinkDefaultPipeline (OptLevel);
850+ MPM = PB.buildThinLTOPreLinkDefaultPipeline (OptLevel);
848851 NeedThinLTOBufferPasses = false ;
849852 break ;
850853 case LLVMRustOptStage::ThinLTO:
Original file line number Diff line number Diff line change @@ -2,16 +2,11 @@ fn main() {
22 println ! ( "cargo:rerun-if-changed=build.rs" ) ;
33 println ! ( "cargo:rustc-check-cfg=cfg(enable_unstable_features)" ) ;
44
5- // Miri testing uses unstable features, so always enable that for its sysroot.
6- // Otherwise, only enable unstable if rustc looks like a nightly or dev build.
7- let enable_unstable_features = std:: env:: var ( "MIRI_CALLED_FROM_SETUP" ) . is_ok ( ) || {
8- let rustc = std:: env:: var ( "RUSTC" ) . unwrap_or_else ( |_| "rustc" . into ( ) ) ;
9- let version = std:: process:: Command :: new ( rustc) . arg ( "-vV" ) . output ( ) . unwrap ( ) ;
10- let stdout = String :: from_utf8 ( version. stdout ) . unwrap ( ) ;
11- stdout. contains ( "nightly" ) || stdout. contains ( "dev" )
12- } ;
5+ let rustc = std:: env:: var ( "RUSTC" ) . unwrap_or_else ( |_| "rustc" . into ( ) ) ;
6+ let version = std:: process:: Command :: new ( rustc) . arg ( "-vV" ) . output ( ) . unwrap ( ) ;
7+ let stdout = String :: from_utf8 ( version. stdout ) . unwrap ( ) ;
138
14- if enable_unstable_features {
9+ if stdout . contains ( "nightly" ) || stdout . contains ( "dev" ) {
1510 println ! ( "cargo:rustc-cfg=enable_unstable_features" ) ;
1611 }
1712}
Original file line number Diff line number Diff line change @@ -741,7 +741,13 @@ impl Step for Miri {
741741
742742 // Run it again for mir-opt-level 4 to catch some miscompilations.
743743 if builder. config . test_args ( ) . is_empty ( ) {
744- cargo. env ( "MIRIFLAGS" , "-O -Zmir-opt-level=4 -Cdebug-assertions=yes" ) ;
744+ cargo. env (
745+ "MIRIFLAGS" ,
746+ format ! (
747+ "{} -O -Zmir-opt-level=4 -Cdebug-assertions=yes" ,
748+ env:: var( "MIRIFLAGS" ) . unwrap_or_default( )
749+ ) ,
750+ ) ;
745751 // Optimizations can change backtraces
746752 cargo. env ( "MIRI_SKIP_UI_CHECKS" , "1" ) ;
747753 // `MIRI_SKIP_UI_CHECKS` and `RUSTC_BLESS` are incompatible
@@ -3108,6 +3114,17 @@ impl Step for Crate {
31083114 // does not set this directly, but relies on the rustc wrapper to set it, and we are not using
31093115 // the wrapper -- hence we have to set it ourselves.
31103116 cargo. rustflag ( "-Zforce-unstable-if-unmarked" ) ;
3117+ // Miri is told to invoke the libtest runner and bootstrap sets unstable flags
3118+ // for that runner. That only works when RUSTC_BOOTSTRAP is set. Bootstrap sets
3119+ // that flag but Miri by default does not forward the host environment to the test.
3120+ // Here we set up MIRIFLAGS to forward that env var.
3121+ cargo. env (
3122+ "MIRIFLAGS" ,
3123+ format ! (
3124+ "{} -Zmiri-env-forward=RUSTC_BOOTSTRAP" ,
3125+ env:: var( "MIRIFLAGS" ) . unwrap_or_default( )
3126+ ) ,
3127+ ) ;
31113128 cargo
31123129 } else {
31133130 // Also prepare a sysroot for the target.
Original file line number Diff line number Diff line change 1+ //! Make sure that the closure still gets the correct precedence when round-tripping
2+ //! through a proc macro.
3+ //! The correct precendence is `(|| ()) as fn()`, even though these parentheses are not
4+ //! directly part of the code.
5+ //! If it would get lost, the code would be `|| () as fn()`, get parsed as
6+ //! `|| (() as fn())` and fail to compile.
7+ //! Notably, this will also fail to compile if we use `recollect` instead of `identity`.
8+ //! Regression test for https://github.com/rust-lang/rust/pull/151830#issuecomment-4010899019.
9+ //@ proc-macro: test-macros.rs
10+ //@ check-pass
11+
12+ macro_rules! operator_impl {
13+ ( $target_expr: expr) => {
14+ test_macros:: identity! {
15+ $target_expr as fn ( )
16+ } ;
17+ } ;
18+ }
19+
20+ fn main ( ) {
21+ operator_impl ! ( || ( ) ) ;
22+ }
Original file line number Diff line number Diff line change @@ -47,14 +47,9 @@ macro_rules! dump_and_die {
4747 // there, even on i686-pc-windows-msvc. We do the best we can in
4848 // rust-lang/rust to test it as well, but sometimes we just gotta keep
4949 // landing PRs.
50- //
51- // aarch64-msvc/arm64ec-msvc is broken as its backtraces are truncated.
52- // See https://github.com/rust-lang/rust/issues/140489
5350 if cfg!( any( target_os = "android" ,
5451 all( target_os = "linux" , target_arch = "arm" ) ,
5552 all( target_env = "msvc" , target_arch = "x86" ) ,
56- all( target_env = "msvc" , target_arch = "aarch64" ) ,
57- all( target_env = "msvc" , target_arch = "arm64ec" ) ,
5853 target_os = "freebsd" ,
5954 target_os = "dragonfly" ,
6055 target_os = "openbsd" ) ) {
You can’t perform that action at this time.
0 commit comments