From 0b3ffcbb0beed7bc0be168dadbff2904b85d3666 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Thu, 22 Dec 2022 10:34:27 -0600 Subject: [PATCH 1/6] Allow building std with cranelift - Don't pass llvm-specific args when using cranelift - Don't use `asm` in compiler_builtins when using cranelift --- compiler/rustc_codegen_llvm/src/intrinsic.rs | 2 +- src/bootstrap/builder.rs | 5 ++++- src/bootstrap/compile.rs | 13 ++++++++++--- src/bootstrap/config.rs | 4 ++++ src/bootstrap/lib.rs | 2 +- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs index 907517bf6ce95..1ce48f82e1c9b 100644 --- a/compiler/rustc_codegen_llvm/src/intrinsic.rs +++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs @@ -567,7 +567,7 @@ fn codegen_msvc_try<'ll>( // module. // // When modifying, make sure that the type_name string exactly matches - // the one used in src/libpanic_unwind/seh.rs. + // the one used in library/panic_unwind/src/seh.rs. let type_info_vtable = bx.declare_global("??_7type_info@@6B@", bx.type_i8p()); let type_name = bx.const_bytes(b"rust_panic\0"); let type_info = diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 8ee6d49da8f0e..dc02814374be6 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -1853,7 +1853,10 @@ impl<'a> Builder<'a> { }; if let Some(limit) = limit { - rustflags.arg(&format!("-Cllvm-args=-import-instr-limit={}", limit)); + if stage == 0 || self.config.default_codegen_backend().unwrap_or_default() == "llvm" + { + rustflags.arg(&format!("-Cllvm-args=-import-instr-limit={}", limit)); + } } } diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 0deed3f990d03..79c3f84a6ae13 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -321,8 +321,15 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car "" }; + let mut features = String::new(); + + // Cranelift doesn't support `asm`. + if stage != 0 && builder.config.default_codegen_backend().unwrap_or_default() == "cranelift" { + features += " compiler-builtins-no-asm"; + } + if builder.no_std(target) == Some(true) { - let mut features = "compiler-builtins-mem".to_string(); + features += " compiler-builtins-mem"; if !target.starts_with("bpf") { features.push_str(compiler_builtins_c_feature); } @@ -335,7 +342,7 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car .arg("--features") .arg(features); } else { - let mut features = builder.std_features(target); + features += &builder.std_features(target); features.push_str(compiler_builtins_c_feature); cargo @@ -754,7 +761,7 @@ pub fn rustc_cargo_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetS .env("CFG_RELEASE_CHANNEL", &builder.config.channel) .env("CFG_VERSION", builder.rust_version()); - if let Some(backend) = builder.config.rust_codegen_backends.get(0) { + if let Some(backend) = builder.config.default_codegen_backend() { cargo.env("CFG_DEFAULT_CODEGEN_BACKEND", backend); } diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 960fbdf753804..41c8f17ee1570 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -1610,6 +1610,10 @@ impl Config { self.submodules.unwrap_or(rust_info.is_managed_git_subrepository()) } + pub fn default_codegen_backend(&self) -> Option> { + self.rust_codegen_backends.get(0).cloned() + } + /// Returns the commit to download, or `None` if we shouldn't download CI artifacts. fn download_ci_rustc_commit(&self, download_rustc: Option) -> Option { // If `download-rustc` is not set, default to rebuilding. diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 570fe6484e3db..63b9ab46e2796 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -782,7 +782,7 @@ impl Build { /// Gets the space-separated set of activated features for the standard /// library. fn std_features(&self, target: TargetSelection) -> String { - let mut features = "panic-unwind".to_string(); + let mut features = " panic-unwind".to_string(); match self.config.llvm_libunwind(target) { LlvmLibunwind::InTree => features.push_str(" llvm-libunwind"), From 164e22109b697ed0bc7dd62039362b2fb5482ef9 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Thu, 22 Dec 2022 11:16:29 -0600 Subject: [PATCH 2/6] Mark `proc_macro_decls_static` as always used This would have avoided a bug in https://github.com/rust-lang/rust/pull/104860. In practice this shouldn't matter since nothing uses the query other than the `dead_code` lint, but this isn't documented as an internal-only query so it seems nice for it to be accurate. I think for `dead_code` it doesn't matter because the relevant code is generated by `rustc_builtin_macros` and isn't linted. --- compiler/rustc_builtin_macros/src/proc_macro_harness.rs | 2 ++ src/test/ui/proc-macro/quote-debug.stdout | 1 + 2 files changed, 3 insertions(+) diff --git a/compiler/rustc_builtin_macros/src/proc_macro_harness.rs b/compiler/rustc_builtin_macros/src/proc_macro_harness.rs index ece660cf6f645..b88de22467537 100644 --- a/compiler/rustc_builtin_macros/src/proc_macro_harness.rs +++ b/compiler/rustc_builtin_macros/src/proc_macro_harness.rs @@ -262,6 +262,7 @@ impl<'a> Visitor<'a> for CollectProcMacros<'a> { // use proc_macro::bridge::client::ProcMacro; // // #[rustc_proc_macro_decls] +// #[used] // #[allow(deprecated)] // static DECLS: &[ProcMacro] = &[ // ProcMacro::custom_derive($name_trait1, &[], ::$name1); @@ -364,6 +365,7 @@ fn mk_decls(cx: &mut ExtCtxt<'_>, macros: &[ProcMacro]) -> P { ) .map(|mut i| { i.attrs.push(cx.attr_word(sym::rustc_proc_macro_decls, span)); + i.attrs.push(cx.attr_word(sym::used, span)); i.attrs.push(cx.attr_nested_word(sym::allow, sym::deprecated, span)); i }); diff --git a/src/test/ui/proc-macro/quote-debug.stdout b/src/test/ui/proc-macro/quote-debug.stdout index d2cc5c6e2a3f7..9f64a1e06b9d4 100644 --- a/src/test/ui/proc-macro/quote-debug.stdout +++ b/src/test/ui/proc-macro/quote-debug.stdout @@ -42,6 +42,7 @@ const _: () = { extern crate proc_macro; #[rustc_proc_macro_decls] + #[used] #[allow(deprecated)] static _DECLS: &[proc_macro::bridge::client::ProcMacro] = &[]; }; From c01985387d8c00e04acc87d04d52e3a5e5c82c10 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Thu, 22 Dec 2022 12:43:27 -0600 Subject: [PATCH 3/6] Make `sess.bug` much less noisy Before: ``` Compiling core v0.0.0 (C:\Users\Joshua Nelson\src\rust2\library\core) error: internal compiler error: no warnings or errors encountered even though `delayed_good_path_bugs` issued error: internal compiler error: oops | = note: delayed at 0: std::backtrace_rs::backtrace::trace_unsynchronized 1: std::backtrace::Backtrace::disabled 2: std::backtrace::Backtrace::force_capture 3: ::delay_good_path_bug::<&str> 4: ::enter::> 5: RINvMs2_NtCsiwHPejSviHg_15rustc_interface7queriesNtNtB8_9interface8Compiler5enterNCNCNvCs7PhwInflpyf_12rustc_driver12run_compilers_0s0_0INtNtCslM5znELOk5i_4core6result6ResultINtNtB2f_6option6OptionNtB6_6LinkerENtCshthk7JDUYGg_12rustc_errors15ErrorGuarante 6: RINvCs6uSsza6NDuD_10rustc_span15with_source_mapINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_errors15ErrorGuaranteedENCNCINvNtCsiwHPejSviHg_15rustc_interface9interface12run_compilerBJ_NCNvCs7PhwInflpyf_12rustc_driver12run_compilers_0E00EB 7: RINvMs_Cs9yvsqs6YnUZ_10scoped_tlsINtB5_9ScopedKeyNtCs6uSsza6NDuD_10rustc_span14SessionGlobalsE3setNCINvNtCsiwHPejSviHg_15rustc_interface9interface12run_compilerINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_errors15ErrorGuaranteedENCNvCs7P 8: RINvNtNtCs5xszGlR5JQw_3std10sys_common9backtrace28___rust_begin_short_backtraceNCNCINvNtCsiwHPejSviHg_15rustc_interface4util31run_in_thread_pool_with_globalsNCINvNtB1o_9interface12run_compilerINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_ 9: RINvNtCs5xszGlR5JQw_3std9panicking3tryINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_errors15ErrorGuaranteedEINtNtNtBF_5panic11unwind_safe16AssertUnwindSafeNCNCINvMNtB4_6threadNtB2S_7Builder16spawn_unchecked_NCNCINvNtCsiwHPejSviHg_15rustc_ 10: ::spawn_scoped::::{closure#0}, ()>::{closure#0}::{closure#0}, ()> 11: as core::ops::function::FnOnce>::call_once 12: std::sys::windows::thread::Thread::new 13: BaseThreadInitThunk 14: RtlUserThreadStart thread 'rustc' panicked at 'Box', compiler\rustc_errors\src\lib.rs:1610:13 stack backtrace: 0: 0x7fffbe935a15 - std::backtrace_rs::backtrace::trace_unsynchronized::h2a29ea0a35c1f799 1: 0x7fffbe968811 - ::fmt::h5e4ca8af47bfbcc0 2: 0x7fffbe98aeab - core::fmt::write::h152a9de2569e7dc7 3: 0x7fffbe961059 - std::io::Write::write_fmt::h2452e19093defac4 4: 0x7fffbe96866b - std::sys_common::backtrace::print::h550d034f7b77d60a 5: 0x7fffbe93be1b - std::panicking::default_hook::h3969ead74039b801 6: 0x7fffbe93bbad - std::panicking::default_hook::h3969ead74039b801 7: 0x7fffa5f0abe3 - rustc_driver[5b2ae43fbecaf219]::handle_options 8: 0x7fffbe93c25b - std::panicking::rust_panic_with_hook::h32bbe3ce24999160 9: 0x7fffa82baee5 - std[4086331e48bff2f6]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> 10: 0x7fffa82bae89 - std[4086331e48bff2f6]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> 11: 0x7fffa867ed89 - std[4086331e48bff2f6]::panicking::begin_panic:: 12: 0x7fffa8298de9 - ::write_fmt 13: 0x7fffa829b7e2 - ::flush_delayed::, ::decorate>, &str> 14: 0x7fffa8288638 - ::drop 15: 0x7fffa5eb90e1 - core[fda266aeadfb153a]::ptr::drop_in_place:: 16: 0x7fffa5ebe9fd - core[fda266aeadfb153a]::ptr::drop_in_place:: 17: 0x7fffa5ec0d7c - core[fda266aeadfb153a]::ptr::drop_in_place:: 18: 0x7fffa5ebe41c - core[fda266aeadfb153a]::ptr::drop_in_place:: 19: 0x7fffa5eea05f - RINvCs6uSsza6NDuD_10rustc_span15with_source_mapINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_errors15ErrorGuaranteedENCNCINvNtCsiwHPejSviHg_15rustc_interface9interface12run_compilerBJ_NCNvCs7PhwInflpyf_12rustc_driver12run_compilers_0E00EB 20: 0x7fffa5edbe3a - RINvMs_Cs9yvsqs6YnUZ_10scoped_tlsINtB5_9ScopedKeyNtCs6uSsza6NDuD_10rustc_span14SessionGlobalsE3setNCINvNtCsiwHPejSviHg_15rustc_interface9interface12run_compilerINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_errors15ErrorGuaranteedENCNvCs7P 21: 0x7fffa5ef4ec9 - RINvNtNtCs5xszGlR5JQw_3std10sys_common9backtrace28___rust_begin_short_backtraceNCNCINvNtCsiwHPejSviHg_15rustc_interface4util31run_in_thread_pool_with_globalsNCINvNtB1o_9interface12run_compilerINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_ 22: 0x7fffa5ee9935 - RINvNtCs5xszGlR5JQw_3std9panicking3tryINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_errors15ErrorGuaranteedEINtNtNtBF_5panic11unwind_safe16AssertUnwindSafeNCNCINvMNtB4_6threadNtB2S_7Builder16spawn_unchecked_NCNCINvNtCsiwHPejSviHg_15rustc_ 23: 0x7fffa5f0d770 - ::spawn_scoped::::{closure#0}, ()>::{closure#0}::{closure#0}, ()> 24: 0x7fffbe95b35b - as core::ops::function::FnOnce>::call_once::hfcd927f7aebafa45 25: 0x7fffbe9331d3 - std::sys::windows::thread::Thread::new::hf8f4c920eaebd965 26: 0x7ff815877614 - BaseThreadInitThunk 27: 0x7ff8166e26a1 - RtlUserThreadStart note: the compiler unexpectedly panicked. this is a bug. note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md note: rustc 1.68.0-dev running on x86_64-pc-windows-msvc note: compiler flags: --crate-type lib -C opt-level=3 -C embed-bitcode=no -C debuginfo=0 -Z unstable-options -C incremental=[REDACTED] -C symbol-mangling-version=legacy -Z unstable-options -Z unstable-options -Z macro-backtrace -C split-debuginfo=packed -C target-feature=+crt-static -C prefer-dynamic -C embed-bitcode=yes -Z crate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/") -Z binary-dep-depinfo -Z force-unstable-if-unmarked note: some of the compiler flags provided by cargo are hidden query stack during panic: end of query stack error: could not compile `core` ``` After: ``` Compiling core v0.0.0 (C:\Users\Joshua Nelson\src\rust2\library\core) error: internal compiler error: no warnings or errors encountered even though `delayed_good_path_bugs` issued error: internal compiler error: oops | = note: delayed at 0: std::backtrace_rs::backtrace::trace_unsynchronized 1: std::backtrace::Backtrace::disabled 2: std::backtrace::Backtrace::force_capture 3: ::delay_good_path_bug::<&str> 4: ::enter::> 5: RINvMs2_NtCsiwHPejSviHg_15rustc_interface7queriesNtNtB8_9interface8Compiler5enterNCNCNvCs7PhwInflpyf_12rustc_driver12run_compilers_0s0_0INtNtCslM5znELOk5i_4core6result6ResultINtNtB2f_6option6OptionNtB6_6LinkerENtCshthk7JDUYGg_12rustc_errors15ErrorGuarante 6: RINvCs6uSsza6NDuD_10rustc_span15with_source_mapINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_errors15ErrorGuaranteedENCNCINvNtCsiwHPejSviHg_15rustc_interface9interface12run_compilerBJ_NCNvCs7PhwInflpyf_12rustc_driver12run_compilers_0E00EB 7: RINvMs_Cs9yvsqs6YnUZ_10scoped_tlsINtB5_9ScopedKeyNtCs6uSsza6NDuD_10rustc_span14SessionGlobalsE3setNCINvNtCsiwHPejSviHg_15rustc_interface9interface12run_compilerINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_errors15ErrorGuaranteedENCNvCs7P 8: RINvNtNtCs5xszGlR5JQw_3std10sys_common9backtrace28___rust_begin_short_backtraceNCNCINvNtCsiwHPejSviHg_15rustc_interface4util31run_in_thread_pool_with_globalsNCINvNtB1o_9interface12run_compilerINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_ 9: RINvNtCs5xszGlR5JQw_3std9panicking3tryINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_errors15ErrorGuaranteedEINtNtNtBF_5panic11unwind_safe16AssertUnwindSafeNCNCINvMNtB4_6threadNtB2S_7Builder16spawn_unchecked_NCNCINvNtCsiwHPejSviHg_15rustc_ 10: ::spawn_scoped::::{closure#0}, ()>::{closure#0}::{closure#0}, ()> 11: as core::ops::function::FnOnce>::call_once 12: std::sys::windows::thread::Thread::new 13: BaseThreadInitThunk 14: RtlUserThreadStart note: the compiler unexpectedly panicked. this is a bug. note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md note: rustc 1.68.0-dev running on x86_64-pc-windows-msvc note: compiler flags: --crate-type lib -C opt-level=3 -C embed-bitcode=no -C debuginfo=0 -Z unstable-options -C incremental=[REDACTED] -C symbol-mangling-version=legacy -Z unstable-options -Z unstable-options -Z macro-backtrace -C split-debuginfo=packed -C target-feature=+crt-static -C prefer-dynamic -C embed-bitcode=yes -Z crate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/") -Z binary-dep-depinfo -Z force-unstable-if-unmarked note: some of the compiler flags provided by cargo are hidden query stack during panic: end of query stack error: could not compile `core` ``` --- compiler/rustc_driver/src/lib.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_driver/src/lib.rs b/compiler/rustc_driver/src/lib.rs index 711eed2b27231..236f66eae72c3 100644 --- a/compiler/rustc_driver/src/lib.rs +++ b/compiler/rustc_driver/src/lib.rs @@ -1199,10 +1199,13 @@ static DEFAULT_HOOK: LazyLock) + Sync + Send + }; // Invoke the default handler, which prints the actual panic message and optionally a backtrace - (*DEFAULT_HOOK)(info); + // Don't do this for `ExplicitBug`, which has an unhelpful message and backtrace. + if !info.payload().is::() { + (*DEFAULT_HOOK)(info); - // Separate the output with an empty line - eprintln!(); + // Separate the output with an empty line + eprintln!(); + } // Print the ICE message report_ice(info, BUG_REPORT_URL); From 898b702695a3fc907e0fff5017dbf744a315b8e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Thu, 22 Dec 2022 00:00:00 +0000 Subject: [PATCH 4/6] Fix the issue number in comment for as_local_call_operand --- compiler/rustc_mir_build/src/build/expr/as_operand.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_mir_build/src/build/expr/as_operand.rs b/compiler/rustc_mir_build/src/build/expr/as_operand.rs index c8610af7038d7..dbcb0132c9f88 100644 --- a/compiler/rustc_mir_build/src/build/expr/as_operand.rs +++ b/compiler/rustc_mir_build/src/build/expr/as_operand.rs @@ -72,7 +72,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { /// will actually provide a pointer to the interior of the box, and not move the `dyn Debug` /// value to the stack. /// - /// See #68034 for more details. + /// See #68304 for more details. pub(crate) fn as_local_call_operand( &mut self, block: BasicBlock, From e4330295d9bcb8ab302000eae60cd8b9a71f2d7a Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Thu, 22 Dec 2022 12:57:47 -0600 Subject: [PATCH 5/6] Give a more helpful error for "trimmed_def_paths construted" --- Cargo.lock | 1 + compiler/rustc_error_messages/src/lib.rs | 2 +- compiler/rustc_middle/Cargo.toml | 2 ++ compiler/rustc_middle/src/ty/print/pretty.rs | 8 +++++++- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 75c3df5b2b74f..6f2f8c26f6428 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4039,6 +4039,7 @@ dependencies = [ "rustc_ast", "rustc_attr", "rustc_data_structures", + "rustc_error_messages", "rustc_errors", "rustc_feature", "rustc_graphviz", diff --git a/compiler/rustc_error_messages/src/lib.rs b/compiler/rustc_error_messages/src/lib.rs index 418ba3c74d776..0b351b7afc720 100644 --- a/compiler/rustc_error_messages/src/lib.rs +++ b/compiler/rustc_error_messages/src/lib.rs @@ -380,7 +380,7 @@ impl> From for DiagnosticMessage { } } -/// A workaround for "good path" ICEs when formatting types in disables lints. +/// A workaround for "good path" ICEs when formatting types in disabled lints. /// /// Delays formatting until `.into(): DiagnosticMessage` is used. pub struct DelayDm(pub F); diff --git a/compiler/rustc_middle/Cargo.toml b/compiler/rustc_middle/Cargo.toml index cf1ab47de861a..543bd56a20c18 100644 --- a/compiler/rustc_middle/Cargo.toml +++ b/compiler/rustc_middle/Cargo.toml @@ -18,6 +18,8 @@ rustc_ast = { path = "../rustc_ast" } rustc_attr = { path = "../rustc_attr" } rustc_data_structures = { path = "../rustc_data_structures" } rustc_errors = { path = "../rustc_errors" } +# Used for intra-doc links +rustc_error_messages = { path = "../rustc_error_messages" } rustc_feature = { path = "../rustc_feature" } rustc_graphviz = { path = "../rustc_graphviz" } rustc_hir = { path = "../rustc_hir" } diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index a1d53506707c9..c49e75d68ad32 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -2883,13 +2883,19 @@ fn for_each_def(tcx: TyCtxt<'_>, mut collect_fn: impl for<'b> FnMut(&'b Ident, N /// `std::vec::Vec` to just `Vec`, as long as there is no other `Vec` importable anywhere. /// /// The implementation uses similar import discovery logic to that of 'use' suggestions. +/// +/// See also [`DelayDm`](rustc_error_messages::DelayDm) and [`with_no_trimmed_paths`]. fn trimmed_def_paths(tcx: TyCtxt<'_>, (): ()) -> FxHashMap { let mut map: FxHashMap = FxHashMap::default(); if let TrimmedDefPaths::GoodPath = tcx.sess.opts.trimmed_def_paths { + // Trimming paths is expensive and not optimized, since we expect it to only be used for error reporting. + // // For good paths causing this bug, the `rustc_middle::ty::print::with_no_trimmed_paths` // wrapper can be used to suppress this query, in exchange for full paths being formatted. - tcx.sess.delay_good_path_bug("trimmed_def_paths constructed"); + tcx.sess.delay_good_path_bug( + "trimmed_def_paths constructed but no error emitted; use `DelayDm` for lints or `with_no_trimmed_paths` for debugging", + ); } let unique_symbols_rev: &mut FxHashMap<(Namespace, Symbol), Option> = From 103816d704133fc954344d551af04cb333b03e94 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Thu, 22 Dec 2022 13:21:48 -0600 Subject: [PATCH 6/6] Avoid running the `Profile` step twice on `x setup` Prevents runs like the following: ``` $ x setup Welcome to the Rust project! What do you want to do with x.py? a) library: Contribute to the standard library b) compiler: Contribute to the compiler itself c) codegen: Contribute to the compiler, and also modify LLVM or codegen d) tools: Contribute to tools which depend on the compiler, but do not modify it directly (e.g. rustdoc, clippy, miri) e) user: Install Rust from source Please choose one (a/b/c/d/e): b To get started, try one of the following commands: - `x.py check` - `x.py build` - `x.py test` For more suggestions, see https://rustc-dev-guide.rust-lang.org/building/suggested.html `x.py` will now use the configuration at /home/nilsh/projects/rustfast/src/bootstrap/defaults/config.compiler.toml Welcome to the Rust project! What do you want to do with x.py? ... ``` --- src/bootstrap/setup.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/bootstrap/setup.rs b/src/bootstrap/setup.rs index 57426ce3d5109..cd360cbef9654 100644 --- a/src/bootstrap/setup.rs +++ b/src/bootstrap/setup.rs @@ -96,6 +96,10 @@ impl Step for Profile { } fn make_run(run: RunConfig<'_>) { + if run.builder.config.dry_run() { + return; + } + // for Profile, `run.paths` will have 1 and only 1 element // this is because we only accept at most 1 path from user input. // If user calls `x.py setup` without arguments, the interactive TUI