Skip to content

rustdoc: add missing CCI union logic - #162346

Open
notriddle wants to merge 4 commits into
rust-lang:mainfrom
notriddle:rustdoc-merge-type
Open

rustdoc: add missing CCI union logic#162346
notriddle wants to merge 4 commits into
rust-lang:mainfrom
notriddle:rustdoc-merge-type

Conversation

@notriddle

Copy link
Copy Markdown
Contributor

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).

Fixes #162334

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).
@rustbot

rustbot commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in src/tools/compiletest

cc @jieyouxu

compiletest directives have been modified. Please add or update docs for the
new or modified directive in src/doc/rustc-dev-guide/.

@rustbot

rustbot commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

r? @lolbinarycat

rustbot has assigned @lolbinarycat.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: rustdoc
  • rustdoc expanded to 8 candidates
  • Random selection from GuillaumeGomez, lolbinarycat

@rustbot rustbot added A-compiletest Area: The compiletest test runner A-rustdoc-js Area: Rustdoc's JS front-end A-rustdoc-search Area: Rustdoc's search feature A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Sep 5, 2026
@rust-log-analyzer

This comment has been minimized.

@lolbinarycat lolbinarycat left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

View changes since this review

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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. That’s the fix. Everything else is test cases.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 8, 2026
@rustbot

rustbot commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@notriddle

Copy link
Copy Markdown
Contributor Author

I grafted the completest changes and new tests onto main (c33d8f3 to be specific), and all the tests passed

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 downstream_type.rs would pass, though. I just pushed a commit that might help make the results deterministic. Does it work?

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@lolbinarycat

Copy link
Copy Markdown
Contributor

The regression was merged in a69a632, which is after the commit you tested against. That’s why the standard library passed.

except grafting onto current main also gives the same result...

@rust-log-analyzer

This comment has been minimized.

@notriddle

notriddle commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

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.

@rust-log-analyzer

This comment has been minimized.

@lolbinarycat

Copy link
Copy Markdown
Contributor

Current main reverted it

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

@notriddle

Copy link
Copy Markdown
Contributor Author
$ 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

@GuillaumeGomez GuillaumeGomez Sep 9, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add more explanations, not just a link to the issue. Makes it much faster when reading what an issue is about.

View changes since the review

@@ -0,0 +1,9 @@
const EXPECTED = [

@GuillaumeGomez GuillaumeGomez Sep 9, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a description for what this test is checking (and the issue link too).

View changes since the review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-compiletest Area: The compiletest test runner A-rustdoc-js Area: Rustdoc's JS front-end A-rustdoc-search Area: Rustdoc's search feature A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rustdoc: Enabling mergeable CCI broke the search functionality for the stdlib and for our internal docs

5 participants