From 768dcbecdd17dfb0b4e406c047f380058cff27f5 Mon Sep 17 00:00:00 2001 From: beepster4096 <19316085+beepster4096@users.noreply.github.com> Date: Thu, 28 Aug 2025 17:41:48 -0700 Subject: [PATCH 1/6] add rust.break-on-ice to bootstrap.toml --- bootstrap.example.toml | 3 +++ src/bootstrap/src/core/builder/cargo.rs | 7 +++++-- src/bootstrap/src/core/config/config.rs | 3 +++ src/bootstrap/src/core/config/toml/rust.rs | 2 ++ src/bootstrap/src/utils/change_tracker.rs | 5 +++++ 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/bootstrap.example.toml b/bootstrap.example.toml index 16fd9241a172a..eac9395779798 100644 --- a/bootstrap.example.toml +++ b/bootstrap.example.toml @@ -856,6 +856,9 @@ # as libstd features, this option can also be used to configure features such as optimize_for_size. #rust.std-features = ["panic_unwind"] +# Trigger a `DebugBreak` after an internal compiler error during bootstrap on Windows +#rust.break-on-ice = true + # ============================================================================= # Distribution options # diff --git a/src/bootstrap/src/core/builder/cargo.rs b/src/bootstrap/src/core/builder/cargo.rs index cdf6fe573e583..c4c23d90ef05c 100644 --- a/src/bootstrap/src/core/builder/cargo.rs +++ b/src/bootstrap/src/core/builder/cargo.rs @@ -877,8 +877,11 @@ impl Builder<'_> { .env("RUSTC_LIBDIR", libdir) .env("RUSTDOC", self.bootstrap_out.join("rustdoc")) .env("RUSTDOC_REAL", rustdoc_path) - .env("RUSTC_ERROR_METADATA_DST", self.extended_error_dir()) - .env("RUSTC_BREAK_ON_ICE", "1"); + .env("RUSTC_ERROR_METADATA_DST", self.extended_error_dir()); + + if self.config.rust_break_on_ice { + cargo.env("RUSTC_BREAK_ON_ICE", "1"); + } // Set RUSTC_WRAPPER to the bootstrap shim, which switches between beta and in-tree // sysroot depending on whether we're building build scripts. diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index d12cc962187f9..678a9b6395228 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -221,6 +221,7 @@ pub struct Config { pub rust_lto: RustcLto, pub rust_validate_mir_opts: Option, pub rust_std_features: BTreeSet, + pub rust_break_on_ice: bool, pub llvm_profile_use: Option, pub llvm_profile_generate: bool, pub llvm_libunwind_default: Option, @@ -550,6 +551,7 @@ impl Config { strip: rust_strip, lld_mode: rust_lld_mode, std_features: rust_std_features, + break_on_ice: rust_break_on_ice, } = toml.rust.unwrap_or_default(); let Llvm { @@ -1269,6 +1271,7 @@ impl Config { reproducible_artifacts: flags_reproducible_artifact, reuse: build_reuse.map(PathBuf::from), rust_analyzer_info, + rust_break_on_ice: rust_break_on_ice.unwrap_or(true), rust_codegen_backends: rust_codegen_backends .map(|backends| parse_codegen_backends(backends, "rust")) .unwrap_or(vec![CodegenBackendKind::Llvm]), diff --git a/src/bootstrap/src/core/config/toml/rust.rs b/src/bootstrap/src/core/config/toml/rust.rs index c54df456d52b0..4832a1d37b777 100644 --- a/src/bootstrap/src/core/config/toml/rust.rs +++ b/src/bootstrap/src/core/config/toml/rust.rs @@ -65,6 +65,7 @@ define_config! { lto: Option = "lto", validate_mir_opts: Option = "validate-mir-opts", std_features: Option> = "std-features", + break_on_ice: Option = "break-on-ice", } } @@ -355,6 +356,7 @@ pub fn check_incompatible_options_for_ci_rustc( download_rustc: _, validate_mir_opts: _, frame_pointers: _, + break_on_ice: _, } = ci_rust_config; // There are two kinds of checks for CI rustc incompatible options: diff --git a/src/bootstrap/src/utils/change_tracker.rs b/src/bootstrap/src/utils/change_tracker.rs index 2cc2fb486fad5..01309072927d0 100644 --- a/src/bootstrap/src/utils/change_tracker.rs +++ b/src/bootstrap/src/utils/change_tracker.rs @@ -536,4 +536,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[ severity: ChangeSeverity::Warning, summary: "It is no longer possible to `x test` with stage 0, except for running compiletest and opting into `build.compiletest-allow-stage0`.", }, + ChangeInfo { + change_id: 145976, + severity: ChangeSeverity::Info, + summary: "Added a new option `rust.break-on-ice` to control if internal compiler errors cause a debug break on Windows.", + }, ]; From fee5cd10c2038176b23b92ea252999d340dba20f Mon Sep 17 00:00:00 2001 From: FrancescoV1985 Date: Wed, 3 Sep 2025 08:32:33 +0200 Subject: [PATCH 2/6] fixes auto-run js checks in tidy --- src/tools/tidy/src/extra_checks/mod.rs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/tools/tidy/src/extra_checks/mod.rs b/src/tools/tidy/src/extra_checks/mod.rs index 31169ec596775..0d4cee8d5dba8 100644 --- a/src/tools/tidy/src/extra_checks/mod.rs +++ b/src/tools/tidy/src/extra_checks/mod.rs @@ -720,21 +720,21 @@ impl ExtraCheckArg { if !self.auto { return true; } - let ext = match self.lang { - ExtraCheckLang::Py => ".py", - ExtraCheckLang::Cpp => ".cpp", - ExtraCheckLang::Shell => ".sh", - ExtraCheckLang::Js => ".js", + match self.lang { ExtraCheckLang::Spellcheck => { - for dir in SPELLCHECK_DIRS { - if Path::new(filepath).starts_with(dir) { - return true; - } - } - return false; + SPELLCHECK_DIRS.iter().any(|dir| Path::new(filepath).starts_with(dir)) } - }; - filepath.ends_with(ext) + lang => { + let exts: &[&str] = match lang { + ExtraCheckLang::Py => &[".py"], + ExtraCheckLang::Cpp => &[".cpp"], + ExtraCheckLang::Shell => &[".sh"], + ExtraCheckLang::Js => &[".js", ".ts"], + ExtraCheckLang::Spellcheck => unreachable!(), + }; + exts.iter().any(|ext| filepath.ends_with(ext)) + } + } } fn has_supported_kind(&self) -> bool { From 858414b6bb223b4f22c2c9748a7ef05a000c3bad Mon Sep 17 00:00:00 2001 From: FrancescoV1985 Date: Thu, 4 Sep 2025 08:55:02 +0200 Subject: [PATCH 3/6] improved solution for function is_non_auto_or_matches --- src/tools/tidy/src/extra_checks/mod.rs | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/tools/tidy/src/extra_checks/mod.rs b/src/tools/tidy/src/extra_checks/mod.rs index 0d4cee8d5dba8..34d9ea92629b3 100644 --- a/src/tools/tidy/src/extra_checks/mod.rs +++ b/src/tools/tidy/src/extra_checks/mod.rs @@ -720,21 +720,19 @@ impl ExtraCheckArg { if !self.auto { return true; } - match self.lang { + let exts: &[&str] = match self.lang { + ExtraCheckLang::Py => &[".py"], + ExtraCheckLang::Cpp => &[".cpp"], + ExtraCheckLang::Shell => &[".sh"], + ExtraCheckLang::Js => &[".js", ".ts"], ExtraCheckLang::Spellcheck => { - SPELLCHECK_DIRS.iter().any(|dir| Path::new(filepath).starts_with(dir)) - } - lang => { - let exts: &[&str] = match lang { - ExtraCheckLang::Py => &[".py"], - ExtraCheckLang::Cpp => &[".cpp"], - ExtraCheckLang::Shell => &[".sh"], - ExtraCheckLang::Js => &[".js", ".ts"], - ExtraCheckLang::Spellcheck => unreachable!(), - }; - exts.iter().any(|ext| filepath.ends_with(ext)) + if SPELLCHECK_DIRS.iter().any(|dir| Path::new(filepath).starts_with(dir)) { + return true; + } + &[] } - } + }; + exts.iter().any(|ext| filepath.ends_with(ext)) } fn has_supported_kind(&self) -> bool { From f19da67ed75468a2cb90572c065d1c3e2a8cadec Mon Sep 17 00:00:00 2001 From: bendn Date: Thu, 4 Sep 2025 14:06:31 +0700 Subject: [PATCH 4/6] add test --- library/std/tests/path.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/library/std/tests/path.rs b/library/std/tests/path.rs index 3577f0d9c7bb6..fa76c50597b05 100644 --- a/library/std/tests/path.rs +++ b/library/std/tests/path.rs @@ -2526,3 +2526,9 @@ fn normalize_lexically() { check_err(r"\\?\UNC\server\share\a\..\.."); } } + +#[test] +/// See issue#146183 +fn compare_path_to_str() { + assert!(&PathBuf::from("x") == "x"); +} From 9c6c5df2c47a2f93bc159427e109adb26a3b7f6d Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 4 Sep 2025 12:29:52 +0200 Subject: [PATCH 5/6] triagebot: fix rustc_allow_const_fn_unstable matcher --- triagebot.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/triagebot.toml b/triagebot.toml index fd6329de923b6..b957c6465e602 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -1313,7 +1313,7 @@ message = """ and explores the possible non-determinism of the intrinsic. """ cc = ["@rust-lang/miri"] -[mentions."#[rustc_allow_const_fn_unstable]"] +[mentions."#[rustc_allow_const_fn_unstable"] type = "content" message = """ `#[rustc_allow_const_fn_unstable]` needs careful audit to avoid accidentally exposing unstable From 1e37c1fe2e29d88d4843e7c0ce46e50edd9f7251 Mon Sep 17 00:00:00 2001 From: bendn Date: Thu, 4 Sep 2025 14:06:44 +0700 Subject: [PATCH 6/6] fix --- library/std/src/path.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/std/src/path.rs b/library/std/src/path.rs index 531a1aa421536..19663e4a9df62 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -2107,7 +2107,7 @@ impl PartialEq for PathBuf { impl cmp::PartialEq for PathBuf { #[inline] fn eq(&self, other: &str) -> bool { - &*self == other + Path::eq(self, other) } }