summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorJakub Beránek <berykubik@gmail.com>2025-06-20 20:03:23 +0200
committerGitHub <noreply@github.com>2025-06-20 20:03:23 +0200
commit64a7fcf26ec6bf4e0629f44ed74fb9fbd5ffe95b (patch)
treef6672d40d146f59ab0594d1ff40e445e5fe987dc /src
parentf2c48543772e69ce170fea0b357cf15ee11dc6d2 (diff)
parentfca6e81735c7d31fcfd39aa10126f3e5041dbecb (diff)
downloadrust-64a7fcf26ec6bf4e0629f44ed74fb9fbd5ffe95b.tar.gz
rust-64a7fcf26ec6bf4e0629f44ed74fb9fbd5ffe95b.zip
Rollup merge of #142758 - jieyouxu:rustdoc-json-types, r=Kobzol
Make sure to rebuild rustdoc if `src/rustdoc-json-types` is changed

I think `rustdoc-json-types` was more recently split out, so this download-rustc logic became outdated as it wasn't tracked. This PR adds `src/rustdoc-json-types` to be tracked for difference versus upstream, so that we properly rebuild rustdoc if it has changes versus upstream.

Fixes rust-lang/rust#142738.

### Local testing

This is not so easy to test locally because it requires download-rustc. To test this, you need to:

1. Disable `download-rustc` inhibition from bootstrap changes versus upstream, by including `:!src/bootstrap` in https://github.com/rust-lang/rust/blob/255aa220821c05c3eac7605fce4ea1c9ab2cbdb4/src/bootstrap/src/core/config/config.rs#L67-L74.
2. Then, use a config like `profile = "tools"` which by default uses `download-rustc = "if-unchanged"`.
3. Run `./x test tests/rustdoc-json` one time, to "prime" initial build caches.
4. Change the `FORMAT_VERSION` in `src/rustdoc-json-types`, i.e.
	```diff
	diff --git a/src/rustdoc-json-types/lib.rs b/src/rustdoc-json-types/lib.rs
	index 1f93895ae07..72a3720c7b4 100644
	--- a/src/rustdoc-json-types/lib.rs
	+++ b/src/rustdoc-json-types/lib.rs
	``@@`` -38,7 +38,7 ``@@``
	 // are deliberately not in a doc comment, because they need not be in public docs.)
	 //
	 // Latest feature: Pretty printing of inline attributes changed
	-pub const FORMAT_VERSION: u32 = 48;
	+pub const FORMAT_VERSION: u32 = 666;
	```
5. Observe that without this patch, `rustdoc-json` tests fail because `FORMAT_VERSION` mismatch. Observe that with this patch, rustdoc gets properly rebuilt and `rustdoc-json` tests pass.

cc ``@aDotInTheVoid``

r? Kobzol
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/src/core/build_steps/tool.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/bootstrap/src/core/build_steps/tool.rs b/src/bootstrap/src/core/build_steps/tool.rs
index 53a5c6b282f..1594080815f 100644
--- a/src/bootstrap/src/core/build_steps/tool.rs
+++ b/src/bootstrap/src/core/build_steps/tool.rs
@@ -716,7 +716,7 @@ impl Step for Rustdoc {
             && target_compiler.stage > 0
             && builder.rust_info().is_managed_git_subrepository()
         {
-            let files_to_track = &["src/librustdoc", "src/tools/rustdoc"];
+            let files_to_track = &["src/librustdoc", "src/tools/rustdoc", "src/rustdoc-json-types"];
 
             // Check if unchanged
             if !builder.config.has_changes_from_upstream(files_to_track) {