提交 455c5e06 编写于 作者: B bors

Auto merge of #85165 - JohnTitor:rollup-ew1ls7x, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #84777 (Apply `--cfg parallel_compiler` when documenting)
 - #84783 (Allow formatting specific subdirectories)
 - #84998 (Show nicer error when an 'unstable fingerprints' error occurs)
 - #85002 (RELEASES.md: Use broken_intra_doc_links as an example, not nightly lint)
 - #85051 (Allow checking miri and RLS with `x.py check src/tools/{miri,rls}`)
 - #85114 (Remove outdated FIXME for download-rustc)
 - #85143 (Document Rc::from)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
......@@ -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]
......
......@@ -232,6 +232,7 @@ fn clone(&self) -> Self { *self }
}
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(
......
......@@ -550,12 +550,10 @@ pub(crate) fn try_collect_active_jobs(
}
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(
......
......@@ -605,13 +605,19 @@ fn incremental_verify_ich<CTX, K, V: Debug>(
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 <https://github.com/rust-lang/rust/issues/84970> for more information"))
.emit();
panic!("Found unstable fingerprints for {:?}: {:?}", dep_node, result);
}
}
fn force_query_with_job<C, CTX>(
......
......@@ -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
......
......@@ -1733,6 +1733,19 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
#[stable(feature = "from_for_ptrs", since = "1.6.0")]
impl<T> From<T> for Rc<T> {
/// Converts a generic type `T` into a `Rc<T>`
///
/// 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)
}
......
......@@ -377,6 +377,8 @@ fn get_step_descriptions(kind: Kind) -> Vec<StepDescription> {
check::Rustdoc,
check::CodegenBackend,
check::Clippy,
check::Miri,
check::Rls,
check::Bootstrap
),
Kind::Test => describe!(
......
......@@ -289,7 +289,8 @@ pub struct $name {
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 @@ fn stamp(
// 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);
......
......@@ -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");
......
......@@ -91,6 +91,7 @@ pub enum Subcommand {
paths: Vec<PathBuf>,
},
Format {
paths: Vec<PathBuf>,
check: bool,
},
Doc {
......@@ -581,7 +582,7 @@ pub fn parse(args: &[String]) -> Flags {
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" => {
......
......@@ -42,7 +42,7 @@ struct RustfmtConfig {
ignore: Vec<String>,
}
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<PathBuf>, _) = 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
......
......@@ -478,8 +478,8 @@ pub fn build(&mut self) {
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 {
......
......@@ -889,7 +889,7 @@ fn run(self, builder: &Builder<'_>) {
);
std::process::exit(1);
}
crate::format::format(&builder.build, !builder.config.cmd.bless());
crate::format::format(&builder.build, !builder.config.cmd.bless(), &[]);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册