rustdoc: add missing CCI union logic - #162346
Conversation
This fixes a bug that was found where `PathBuf` didn't show up in the standard library search results, because the crate that defined it (libstd) was merged into a crate that already had a path entry in its search index (libproc_macro).
|
Some changes occurred in src/tools/compiletest cc @jieyouxu
|
|
rustbot has assigned @lolbinarycat. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
41a8c38 to
62adee1
Compare
There was a problem hiding this comment.
I grafted the completest changes and new tests onto main (c33d8f3 to be specific), and all the tests passed, which suggests to me that the changed behavior is not actually getting exercised, likely due differences in how std docs are built for test vs release.
| for other_entryid in 0..other.names.len() { | ||
| if skips.contains(&other_entryid) { | ||
| // we push tombstone entries to keep the IDs lined up | ||
| self.push(String::new(), None, None, String::new(), None, None, None); |
There was a problem hiding this comment.
As I understand it, the only change is the behavior in this case, instead of having everything be a default value, instead only path_data is None, and everything else retains its normal value?
There was a problem hiding this comment.
Yes. That’s the fix. Everything else is test cases.
|
Reminder, once the PR becomes ready for a review, use |
The regression was merged in a69a632, which is after the commit you tested against. That’s why the standard library passed. I’m can only guess why |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
except grafting onto current main also gives the same result... |
This comment has been minimized.
This comment has been minimized.
|
Current main reverted it. To see the standard library failure, you need to graft the test case between when the regression was added and when it was reverted. |
This comment has been minimized.
This comment has been minimized.
that doesn't explain why the tests that manually re-enable it also pass... please ensure that all of your tests actually function correctly, and document your methodology so i can replicate it |
ece9987 to
724f4af
Compare
$ git clone https://github.com/rust-lang/rust.git --revision a69a63265cfd9e006d43137f98301b8d274ad4c9
Cloning into 'rust'...
remote: Enumerating objects: 3478694, done.
remote: Counting objects: 100% (24/24), done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 3478694 (delta 13), reused 11 (delta 11), pack-reused 3478670 (from 1)
Receiving objects: 100% (3478694/3478694), 941.84 MiB | 15.55 MiB/s, done.
Resolving deltas: 100% (2691467/2691467), done.
Note: switching to 'a69a63265cfd9e006d43137f98301b8d274ad4c9'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
Updating files: 100% (62604/62604), done.
$ cd rust
$ sed 's@#build.doc-stage = 0@build.doc-stage = 2@g' < bootstrap.example.toml > bootstrap.toml
$ git fetch origin be3136b71bfb1d1749881fa2e5c8182bd046d294
remote: Enumerating objects: 3481701, done.
remote: Counting objects: 100% (16/16), done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 3481701 (delta 7), reused 6 (delta 6), pack-reused 3481685 (from 1)
Receiving objects: 100% (3481701/3481701), 945.18 MiB | 20.96 MiB/s, done.
Resolving deltas: 100% (2693985/2693985), done.
From https://github.com/rust-lang/rust
* branch be3136b71bfb1d1749881fa2e5c8182bd046d294 -> FETCH_HEAD
$ git cherry-pick be3136b71bfb1d1749881fa2e5c8182bd046d294
[detached HEAD 309e2fae34ad] Add regression test for PathBuf not showing up
Date: Sat Sep 5 14:58:18 2026 -0700
1 file changed, 9 insertions(+)
create mode 100644 tests/rustdoc-js-std/pathbuf.js
# [ignore a bunch of submodule warnings, because x.py will fix them]
$ git fetch origin 62adee17e57cd012b16946e2afafc31d1264785d
remote: Enumerating objects: 3481722, done.
remote: Counting objects: 100% (24/24), done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 3481722 (delta 13), reused 11 (delta 11), pack-reused 3481698 (from 1)
Receiving objects: 100% (3481722/3481722), 943.37 MiB | 22.64 MiB/s, done.
Resolving deltas: 100% (2693813/2693813), done.
From https://github.com/rust-lang/rust
* branch 62adee17e57cd012b16946e2afafc31d1264785d -> FETCH_HEAD
# [ignore a bunch of submodule warnings, because x.py will fix them]
$ git cherry-pick 62adee17e57cd012b16946e2afafc31d1264785d
Auto-merging src/librustdoc/html/render/search_index.rs
CONFLICT (content): Merge conflict in src/librustdoc/html/render/search_index.rs
error: could not apply 62adee17e57c... Add regression test for merging search index types
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
$ git checkout HEAD src/librustdoc
Updated 1 path from ee0ede9aba60
$ git cherry-pick --continue
[detached HEAD 8d3c3e310604] Add regression test for merging search index types
Date: Sat Sep 5 15:43:54 2026 -0700
7 files changed, 122 insertions(+), 3 deletions(-)
create mode 100644 tests/rustdoc-js/auxiliary/upstream-type.rs
create mode 100644 tests/rustdoc-js/downstream-type.js
create mode 100644 tests/rustdoc-js/downstream-type.rs
$ ./x test tests/rustdoc-js-std
# [lots of output]
[ query `PathBuf`]==> Result not found in 'others': '{"path":"std::path","name":"PathBuf"}'
Diff of first error:
{
- "path": "std::path",
+ "path": "std::path::Path",
- "name": "PathBuf",
+ "name": "to_path_buf",
}
$ ./x test tests/rustdoc-js
# [lots of output]
Testing /Users/michaelhowell/rust/tests/rustdoc-js/downstream-type.js ... FAILED
[ query `FooBar`]==> Expected exactly 1 results but found 0 in 'others'
[ query `FooBar`]==> Result not found in 'others': '{"path":"upstream_type","name":"FooBar"}'
Diff of first error:
{
- "path": "upstream_type",
- "name": "FooBar",
}
------------------------------------------
stderr: none
---- [rustdoc-js] tests/rustdoc-js/downstream-type.rs stdout end ----
failures:
[rustdoc-js] tests/rustdoc-js/downstream-type.rs |
| // exact-check | ||
| // ignore-order | ||
|
|
||
| // https://github.com/rust-lang/rust/issues/162334 |
There was a problem hiding this comment.
Please add more explanations, not just a link to the issue. Makes it much faster when reading what an issue is about.
| @@ -0,0 +1,9 @@ | |||
| const EXPECTED = [ | |||
There was a problem hiding this comment.
Please add a description for what this test is checking (and the issue link too).
This fixes a bug that was found where
PathBufdidn't show up in the standard library search results, because the crate that defined it (libstd) was merged into a crate that already had a path entry in its search index (libproc_macro).Fixes #162334