diff --git a/RELEASES.md b/RELEASES.md index 1f940e6bc2d3b..92312d8d556ee 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -58,7 +58,7 @@ The following previously stable APIs are now `const`. Rustdoc ------- - [Rustdoc lints are now treated as a tool lint, meaning that - lints are now prefixed with `rustdoc::` (e.g. `#[warn(rustdoc::non_autolinks)]`).][80527] + lints are now prefixed with `rustdoc::` (e.g. `#[warn(rustdoc::broken_intra_doc_links)]`).][80527] Using the old style is still allowed, and will become a warning in a future release. - [Rustdoc now supports argument files.][82261] diff --git a/compiler/rustc_middle/src/ty/query/mod.rs b/compiler/rustc_middle/src/ty/query/mod.rs index 81230e32f56bd..068f81486118a 100644 --- a/compiler/rustc_middle/src/ty/query/mod.rs +++ b/compiler/rustc_middle/src/ty/query/mod.rs @@ -232,6 +232,7 @@ macro_rules! define_callbacks { } pub trait QueryEngine<'tcx>: rustc_data_structures::sync::Sync { + #[cfg(parallel_compiler)] unsafe fn deadlock(&'tcx self, tcx: TyCtxt<'tcx>, registry: &rustc_rayon_core::Registry); fn encode_query_results( diff --git a/compiler/rustc_query_impl/src/plumbing.rs b/compiler/rustc_query_impl/src/plumbing.rs index ee914fa1ba95c..c789aa2fa596e 100644 --- a/compiler/rustc_query_impl/src/plumbing.rs +++ b/compiler/rustc_query_impl/src/plumbing.rs @@ -550,12 +550,10 @@ macro_rules! define_queries_struct { } impl QueryEngine<'tcx> for Queries<'tcx> { - unsafe fn deadlock(&'tcx self, _tcx: TyCtxt<'tcx>, _registry: &rustc_rayon_core::Registry) { - #[cfg(parallel_compiler)] - { - let tcx = QueryCtxt { tcx: _tcx, queries: self }; - rustc_query_system::query::deadlock(tcx, _registry) - } + #[cfg(parallel_compiler)] + unsafe fn deadlock(&'tcx self, tcx: TyCtxt<'tcx>, registry: &rustc_rayon_core::Registry) { + let tcx = QueryCtxt { tcx, queries: self }; + rustc_query_system::query::deadlock(tcx, registry) } fn encode_query_results( diff --git a/compiler/rustc_query_system/src/query/plumbing.rs b/compiler/rustc_query_system/src/query/plumbing.rs index 68d2d619aabb4..39dfdd78cc4f5 100644 --- a/compiler/rustc_query_system/src/query/plumbing.rs +++ b/compiler/rustc_query_system/src/query/plumbing.rs @@ -605,13 +605,19 @@ fn incremental_verify_ich( let old_hash = tcx.dep_graph().prev_fingerprint_of(dep_node); - assert_eq!( - Some(new_hash), - old_hash, - "found unstable fingerprints for {:?}: {:?}", - dep_node, - result - ); + if Some(new_hash) != old_hash { + let run_cmd = if let Some(crate_name) = &tcx.sess().opts.crate_name { + format!("`cargo clean -p {}` or `cargo clean`", crate_name) + } else { + "`cargo clean`".to_string() + }; + tcx.sess().struct_err(&format!("internal compiler error: encountered incremental compilation error with {:?}", dep_node)) + .help(&format!("This is a known issue with the compiler. Run {} to allow your project to compile", run_cmd)) + .note(&format!("Please follow the instructions below to create a bug report with the provided information")) + .note(&format!("See for more information")) + .emit(); + panic!("Found unstable fingerprints for {:?}: {:?}", dep_node, result); + } } fn force_query_with_job( diff --git a/config.toml.example b/config.toml.example index 6e5584797b559..16952a5ced83e 100644 --- a/config.toml.example +++ b/config.toml.example @@ -372,8 +372,6 @@ changelog-seen = 2 # This is mostly useful for tools; if you have changes to `compiler/` they will be ignored. # # You can set this to "if-unchanged" to only download if `compiler/` has not been modified. -# -# FIXME(#82739): currently, this also uses the downloaded compiler for stage0, but that causes unnecessary rebuilds. #download-rustc = false # Number of codegen units to use for each compiler invocation. A value of 0 diff --git a/library/alloc/src/rc.rs b/library/alloc/src/rc.rs index 964169a227f64..800952f7a5ece 100644 --- a/library/alloc/src/rc.rs +++ b/library/alloc/src/rc.rs @@ -1733,6 +1733,19 @@ impl fmt::Pointer for Rc { #[stable(feature = "from_for_ptrs", since = "1.6.0")] impl From for Rc { + /// Converts a generic type `T` into a `Rc` + /// + /// The conversion allocates on the heap and moves `t` + /// from the stack into it. + /// + /// # Example + /// ```rust + /// # use std::rc::Rc; + /// let x = 5; + /// let rc = Rc::new(5); + /// + /// assert_eq!(Rc::from(x), rc); + /// ``` fn from(t: T) -> Self { Rc::new(t) } diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 5604e14f2d594..789267aa880fa 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -377,6 +377,8 @@ impl<'a> Builder<'a> { check::Rustdoc, check::CodegenBackend, check::Clippy, + check::Miri, + check::Rls, check::Bootstrap ), Kind::Test => describe!( diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index 8561a2a39b8ea..3e9d921d0f526 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -289,7 +289,8 @@ macro_rules! tool_check_step { impl Step for $name { type Output = (); const ONLY_HOSTS: bool = true; - const DEFAULT: bool = true $( && $default )?; + // don't ever check out-of-tree tools by default, they'll fail when toolstate is broken + const DEFAULT: bool = matches!($source_type, SourceType::InTree) $( && $default )?; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { run.paths(&[ $path, $($alias),* ]) @@ -367,6 +368,8 @@ tool_check_step!(Rustdoc, "src/tools/rustdoc", "src/librustdoc", SourceType::InT // behavior, treat it as in-tree so that any new warnings in clippy will be // rejected. tool_check_step!(Clippy, "src/tools/clippy", SourceType::InTree); +tool_check_step!(Miri, "src/tools/miri", SourceType::Submodule); +tool_check_step!(Rls, "src/tools/rls", SourceType::Submodule); tool_check_step!(Bootstrap, "src/bootstrap", SourceType::InTree, false); diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 66a88e85fea39..2676b3bf8e005 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -648,6 +648,7 @@ pub fn rustc_cargo_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetS } if builder.config.rustc_parallel { cargo.rustflag("--cfg=parallel_compiler"); + cargo.rustdocflag("--cfg=parallel_compiler"); } if builder.config.rust_verify_llvm_ir { cargo.env("RUSTC_VERIFY_LLVM_IR", "1"); diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs index d961e067db37c..80a60c79edfe4 100644 --- a/src/bootstrap/flags.rs +++ b/src/bootstrap/flags.rs @@ -91,6 +91,7 @@ pub enum Subcommand { paths: Vec, }, Format { + paths: Vec, check: bool, }, Doc { @@ -581,7 +582,7 @@ Arguments: Subcommand::Clean { all: matches.opt_present("all") } } - "fmt" => Subcommand::Format { check: matches.opt_present("check") }, + "fmt" => Subcommand::Format { check: matches.opt_present("check"), paths }, "dist" => Subcommand::Dist { paths }, "install" => Subcommand::Install { paths }, "run" | "r" => { diff --git a/src/bootstrap/format.rs b/src/bootstrap/format.rs index d21e3408144fe..2408344487bb1 100644 --- a/src/bootstrap/format.rs +++ b/src/bootstrap/format.rs @@ -42,7 +42,7 @@ struct RustfmtConfig { ignore: Vec, } -pub fn format(build: &Build, check: bool) { +pub fn format(build: &Build, check: bool, paths: &[PathBuf]) { if build.config.dry_run { return; } @@ -118,8 +118,19 @@ pub fn format(build: &Build, check: bool) { .to_path_buf(); let src = build.src.clone(); let (tx, rx): (SyncSender, _) = std::sync::mpsc::sync_channel(128); - let walker = - WalkBuilder::new(src.clone()).types(matcher).overrides(ignore_fmt).build_parallel(); + let walker = match paths.get(0) { + Some(first) => { + let mut walker = WalkBuilder::new(first); + for path in &paths[1..] { + walker.add(path); + } + walker + } + None => WalkBuilder::new(src.clone()), + } + .types(matcher) + .overrides(ignore_fmt) + .build_parallel(); // there is a lot of blocking involved in spawning a child process and reading files to format. // spawn more processes than available concurrency to keep the CPU busy diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 24da44b933abc..2960dd3df6bf4 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -478,8 +478,8 @@ impl Build { job::setup(self); } - if let Subcommand::Format { check } = self.config.cmd { - return format::format(self, check); + if let Subcommand::Format { check, paths } = &self.config.cmd { + return format::format(self, *check, &paths); } if let Subcommand::Clean { all } = self.config.cmd { diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index df467bebe7481..78163651158ed 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -889,7 +889,7 @@ help: to skip test's attempt to check tidiness, pass `--exclude src/tools/tidy` ); std::process::exit(1); } - crate::format::format(&builder.build, !builder.config.cmd.bless()); + crate::format::format(&builder.build, !builder.config.cmd.bless(), &[]); } }