Skip to content

Commit 455c5e0

Browse files
committed
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
2 parents d4d129d + 081dd99 commit 455c5e0

File tree

13 files changed

+58
-24
lines changed

13 files changed

+58
-24
lines changed

RELEASES.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ The following previously stable APIs are now `const`.
5858
Rustdoc
5959
-------
6060
- [Rustdoc lints are now treated as a tool lint, meaning that
61-
lints are now prefixed with `rustdoc::` (e.g. `#[warn(rustdoc::non_autolinks)]`).][80527]
61+
lints are now prefixed with `rustdoc::` (e.g. `#[warn(rustdoc::broken_intra_doc_links)]`).][80527]
6262
Using the old style is still allowed, and will become a warning in
6363
a future release.
6464
- [Rustdoc now supports argument files.][82261]

compiler/rustc_middle/src/ty/query/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ macro_rules! define_callbacks {
232232
}
233233

234234
pub trait QueryEngine<'tcx>: rustc_data_structures::sync::Sync {
235+
#[cfg(parallel_compiler)]
235236
unsafe fn deadlock(&'tcx self, tcx: TyCtxt<'tcx>, registry: &rustc_rayon_core::Registry);
236237

237238
fn encode_query_results(

compiler/rustc_query_impl/src/plumbing.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -550,12 +550,10 @@ macro_rules! define_queries_struct {
550550
}
551551

552552
impl QueryEngine<'tcx> for Queries<'tcx> {
553-
unsafe fn deadlock(&'tcx self, _tcx: TyCtxt<'tcx>, _registry: &rustc_rayon_core::Registry) {
554-
#[cfg(parallel_compiler)]
555-
{
556-
let tcx = QueryCtxt { tcx: _tcx, queries: self };
557-
rustc_query_system::query::deadlock(tcx, _registry)
558-
}
553+
#[cfg(parallel_compiler)]
554+
unsafe fn deadlock(&'tcx self, tcx: TyCtxt<'tcx>, registry: &rustc_rayon_core::Registry) {
555+
let tcx = QueryCtxt { tcx, queries: self };
556+
rustc_query_system::query::deadlock(tcx, registry)
559557
}
560558

561559
fn encode_query_results(

compiler/rustc_query_system/src/query/plumbing.rs

+13-7
Original file line numberDiff line numberDiff line change
@@ -605,13 +605,19 @@ fn incremental_verify_ich<CTX, K, V: Debug>(
605605

606606
let old_hash = tcx.dep_graph().prev_fingerprint_of(dep_node);
607607

608-
assert_eq!(
609-
Some(new_hash),
610-
old_hash,
611-
"found unstable fingerprints for {:?}: {:?}",
612-
dep_node,
613-
result
614-
);
608+
if Some(new_hash) != old_hash {
609+
let run_cmd = if let Some(crate_name) = &tcx.sess().opts.crate_name {
610+
format!("`cargo clean -p {}` or `cargo clean`", crate_name)
611+
} else {
612+
"`cargo clean`".to_string()
613+
};
614+
tcx.sess().struct_err(&format!("internal compiler error: encountered incremental compilation error with {:?}", dep_node))
615+
.help(&format!("This is a known issue with the compiler. Run {} to allow your project to compile", run_cmd))
616+
.note(&format!("Please follow the instructions below to create a bug report with the provided information"))
617+
.note(&format!("See <https://github.com/rust-lang/rust/issues/84970> for more information"))
618+
.emit();
619+
panic!("Found unstable fingerprints for {:?}: {:?}", dep_node, result);
620+
}
615621
}
616622

617623
fn force_query_with_job<C, CTX>(

config.toml.example

-2
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,6 @@ changelog-seen = 2
372372
# This is mostly useful for tools; if you have changes to `compiler/` they will be ignored.
373373
#
374374
# You can set this to "if-unchanged" to only download if `compiler/` has not been modified.
375-
#
376-
# FIXME(#82739): currently, this also uses the downloaded compiler for stage0, but that causes unnecessary rebuilds.
377375
#download-rustc = false
378376

379377
# Number of codegen units to use for each compiler invocation. A value of 0

library/alloc/src/rc.rs

+13
Original file line numberDiff line numberDiff line change
@@ -1733,6 +1733,19 @@ impl<T: ?Sized> fmt::Pointer for Rc<T> {
17331733

17341734
#[stable(feature = "from_for_ptrs", since = "1.6.0")]
17351735
impl<T> From<T> for Rc<T> {
1736+
/// Converts a generic type `T` into a `Rc<T>`
1737+
///
1738+
/// The conversion allocates on the heap and moves `t`
1739+
/// from the stack into it.
1740+
///
1741+
/// # Example
1742+
/// ```rust
1743+
/// # use std::rc::Rc;
1744+
/// let x = 5;
1745+
/// let rc = Rc::new(5);
1746+
///
1747+
/// assert_eq!(Rc::from(x), rc);
1748+
/// ```
17361749
fn from(t: T) -> Self {
17371750
Rc::new(t)
17381751
}

src/bootstrap/builder.rs

+2
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,8 @@ impl<'a> Builder<'a> {
377377
check::Rustdoc,
378378
check::CodegenBackend,
379379
check::Clippy,
380+
check::Miri,
381+
check::Rls,
380382
check::Bootstrap
381383
),
382384
Kind::Test => describe!(

src/bootstrap/check.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,8 @@ macro_rules! tool_check_step {
289289
impl Step for $name {
290290
type Output = ();
291291
const ONLY_HOSTS: bool = true;
292-
const DEFAULT: bool = true $( && $default )?;
292+
// don't ever check out-of-tree tools by default, they'll fail when toolstate is broken
293+
const DEFAULT: bool = matches!($source_type, SourceType::InTree) $( && $default )?;
293294

294295
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
295296
run.paths(&[ $path, $($alias),* ])
@@ -367,6 +368,8 @@ tool_check_step!(Rustdoc, "src/tools/rustdoc", "src/librustdoc", SourceType::InT
367368
// behavior, treat it as in-tree so that any new warnings in clippy will be
368369
// rejected.
369370
tool_check_step!(Clippy, "src/tools/clippy", SourceType::InTree);
371+
tool_check_step!(Miri, "src/tools/miri", SourceType::Submodule);
372+
tool_check_step!(Rls, "src/tools/rls", SourceType::Submodule);
370373

371374
tool_check_step!(Bootstrap, "src/bootstrap", SourceType::InTree, false);
372375

src/bootstrap/compile.rs

+1
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,7 @@ pub fn rustc_cargo_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetS
648648
}
649649
if builder.config.rustc_parallel {
650650
cargo.rustflag("--cfg=parallel_compiler");
651+
cargo.rustdocflag("--cfg=parallel_compiler");
651652
}
652653
if builder.config.rust_verify_llvm_ir {
653654
cargo.env("RUSTC_VERIFY_LLVM_IR", "1");

src/bootstrap/flags.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ pub enum Subcommand {
9191
paths: Vec<PathBuf>,
9292
},
9393
Format {
94+
paths: Vec<PathBuf>,
9495
check: bool,
9596
},
9697
Doc {
@@ -581,7 +582,7 @@ Arguments:
581582

582583
Subcommand::Clean { all: matches.opt_present("all") }
583584
}
584-
"fmt" => Subcommand::Format { check: matches.opt_present("check") },
585+
"fmt" => Subcommand::Format { check: matches.opt_present("check"), paths },
585586
"dist" => Subcommand::Dist { paths },
586587
"install" => Subcommand::Install { paths },
587588
"run" | "r" => {

src/bootstrap/format.rs

+14-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ struct RustfmtConfig {
4242
ignore: Vec<String>,
4343
}
4444

45-
pub fn format(build: &Build, check: bool) {
45+
pub fn format(build: &Build, check: bool, paths: &[PathBuf]) {
4646
if build.config.dry_run {
4747
return;
4848
}
@@ -118,8 +118,19 @@ pub fn format(build: &Build, check: bool) {
118118
.to_path_buf();
119119
let src = build.src.clone();
120120
let (tx, rx): (SyncSender<PathBuf>, _) = std::sync::mpsc::sync_channel(128);
121-
let walker =
122-
WalkBuilder::new(src.clone()).types(matcher).overrides(ignore_fmt).build_parallel();
121+
let walker = match paths.get(0) {
122+
Some(first) => {
123+
let mut walker = WalkBuilder::new(first);
124+
for path in &paths[1..] {
125+
walker.add(path);
126+
}
127+
walker
128+
}
129+
None => WalkBuilder::new(src.clone()),
130+
}
131+
.types(matcher)
132+
.overrides(ignore_fmt)
133+
.build_parallel();
123134

124135
// there is a lot of blocking involved in spawning a child process and reading files to format.
125136
// spawn more processes than available concurrency to keep the CPU busy

src/bootstrap/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -478,8 +478,8 @@ impl Build {
478478
job::setup(self);
479479
}
480480

481-
if let Subcommand::Format { check } = self.config.cmd {
482-
return format::format(self, check);
481+
if let Subcommand::Format { check, paths } = &self.config.cmd {
482+
return format::format(self, *check, &paths);
483483
}
484484

485485
if let Subcommand::Clean { all } = self.config.cmd {

src/bootstrap/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ help: to skip test's attempt to check tidiness, pass `--exclude src/tools/tidy`
889889
);
890890
std::process::exit(1);
891891
}
892-
crate::format::format(&builder.build, !builder.config.cmd.bless());
892+
crate::format::format(&builder.build, !builder.config.cmd.bless(), &[]);
893893
}
894894
}
895895

0 commit comments

Comments
 (0)