compiletest: "diff against nightly rustdoc" is actually against default toolchain
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Summary
The "diff against nightly" feature for rustdoc tests sometimes stable rustdoc, resulting in a spurious diff
Command used
./x test tests/rustdoc/whitespace-after-where-clause.rs
I'd also modified rustdoc, so that this test fails
Expected behaviour
compiletest prints out a diff between what nightly and in-tree rustdoc produces.
Actual behaviour
compiletest prints out a diff between what nightly and stable rustdoc produces.
This leads to a load of spurious diff:
@@ -409,9 +409,9 @@
<details class="toggle implementors-toggle">
<summary>
<section id="impl-TryInto%3CU%3E-for-T" class="impl">
- <a class="src rightside" href="https://doc.rust-lang.org/1.87.0/src/core/convert/mod.rs.html#791-793">Source</a><a href="#impl-TryInto%3CU%3E-for-T" class="anchor">§</a>
+ <a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#797-799">Source</a><a href="#impl-TryInto%3CU%3E-for-T" class="anchor">§</a>
<h3 class="code-header">
- impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.87.0/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T
+ impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T
</h3>
<div class="where">
<h3 class="code-header">
@@ -418,4 +418,4 @@
- where U: <a class="trait" href="https://doc.rust-lang.org/1.87.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>,
+ where U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>,
</h3>
</div>
</section>
Bootstrap configuration (bootstrap.toml)
profile = "tools"
change-id = "ignore"
[rust]
deny-warnings = false
Operating system
Ubuntu 24.04.1 LTS (Noble Numbat)
HEAD
14863ea0777c68348b3e6e7a8472423d273a52af
Also, this diff to rustdoc which makes it fail the test:
diff --git a/src/librustdoc/clean/blanket_impl.rs b/src/librustdoc/clean/blanket_impl.rs
index 89245fee515..5ce0a3654a9 100644
--- a/src/librustdoc/clean/blanket_impl.rs
+++ b/src/librustdoc/clean/blanket_impl.rs
@@ -93,7 +93,7 @@ pub(crate) fn synthesize_blanket_impls(
generics: clean_ty_generics(
cx,
tcx.generics_of(impl_def_id),
- tcx.explicit_predicates_of(impl_def_id),
+ tcx.predicates_of(impl_def_id),
),
// FIXME(eddyb) compute both `trait_` and `for_` from
// the post-inference `trait_ref`, as it's more accurate.
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index 7658e7ad35f..93e643bcd6e 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -2832,7 +2832,7 @@ fn get_name(
}),
ItemKind::Struct(_, generics, variant_data) => StructItem(Struct {
ctor_kind: variant_data.ctor_kind(),
- generics: clean_generics(generics, cx),
+ generics: clean_ty_generics(cx, cx.tcx.generics_of(def_id), cx.tcx.predicates_of(def_id)),
fields: variant_data.fields().iter().map(|x| clean_field(x, cx)).collect(),
}),
ItemKind::Macro(_, macro_def, MacroKind::Bang) => MacroItem(Macro {
Additional context
It looks like compiletest uses the default toolchain, rather than nightly
For me, that's stable. Doing rustup override set nightly fixes this.
Build Log (as a gist, because it's too long for github issues)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/tools/compiletest/src/runtest.rs at lines 1961-1975, then run ./x test tests/rustdoc/whitespace-after-where-clause.rs with the reported toolchain setup. Trace which rustdoc executable the "diff against nightly" path invokes. Done means the comparison uses nightly and in-tree rustdoc as expected, including when rustdoc is modified so the test fails.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- testing-qa, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100