Skip to content

Conversation

@yotamofek
Copy link
Contributor

@yotamofek yotamofek commented Nov 29, 2025

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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 Nov 29, 2025
@yotamofek
Copy link
Contributor Author

yotamofek commented Nov 29, 2025

@lolbinarycat Felt like doing something semi-mechanical that doesn't require too much concentration, so thought I'd tackle the issue you opened.

But TBH, after pulling out the common code into an IndexItem constructor, I'm not sure it makes much sense and/or is worth it.
What do you think?

@rust-log-analyzer

This comment has been minimized.

@yotamofek yotamofek force-pushed the pr/rustdoc/IndexItem-new branch from 5e3263a to 32d0484 Compare November 29, 2025 17:11
@yotamofek yotamofek force-pushed the pr/rustdoc/IndexItem-new branch from 32d0484 to 6cedf2c Compare November 29, 2025 17:13
Comment on lines +161 to +164
let desc = short_markdown_summary(&item.doc_value(), &item.link_names(cache));
let search_type = get_function_type_for_search(item, tcx, impl_generics, parent_did, cache);
let aliases = item.attrs.get_doc_aliases();
let deprecation = item.deprecation(tcx);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wonder if it makes sense to extract this subset of fields into a separate struct and include is a field on IndexItem?
Then maybe its constructor won't have to handle so many differences in behavior between the two call sites

@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu-llvm-20-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
Testing alias-lev.js ... OK
Testing alias.js ... OK
Testing asrawfd.js ... OK
Testing basic.js ... FAILED
==> Result not found in 'returned': '{"path":"std::string::String","name":"new"}'
Diff of first error:
 {
-    "path": "std::string::String",
+    "path": "std::string",
     "name": "new",
---
Testing filter-crate.js ... OK
Testing filter-macro-attr-derive.js ... OK
Testing fn-forget.js ... OK
Testing from_u.js ... FAILED
==> Result not found in 'others': '{"path":"std::string::String","name":"from_utf8"}'
Diff of first error:
 {
-    "path": "std::string::String",
+    "path": "std::char",
-    "name": "from_utf8",
+    "name": "from_u32",
 }
Testing full-path-function.js ... FAILED
==> Result not found in 'others': '{"path":"std::vec::Vec","name":"len"}'
Diff of first error:
 {
-    "path": "std::vec::Vec",
+    "path": "std::vec",
     "name": "len",
 }
==> Result not found in 'others': '{"path":"std::vec::Vec","name":"capacity"}'
Diff of first error:
 {
-    "path": "std::vec::Vec",
+    "path": "std::vec",
     "name": "capacity",
 }
Testing iterator-type-signatures.js ... OK
Testing keyword.js ... OK
Testing macro-check.js ... OK
Testing macro-print.js ... OK
Testing never.js ... OK
Testing option-type-signatures.js ... FAILED
[ query `option, fnonce -> option`]==> Result not found in 'others': '{"path":"std::option::Option","name":"map","displayType":"`Option`<T>, F -> `Option`<U>","displayWhereClause":"F: `FnOnce` (T) -> U"}'
Diff of first error:
 {
-    "path": "std::option::Option",
+    "path": "std::option",
-    "name": "map",
+    "name": "inspect",
-    "displayType": "`Option`<T>, F -> `Option`<U>",
+    "displayType": "`Option`<T>, F -> `Option`<T>",
-    "displayWhereClause": "F: `FnOnce` (T) -> U",
+    "displayWhereClause": "F: `FnOnce` (&T)",
 }
Testing osstring-to-string.js ... OK
Testing parser-bindings.js ... OK
Testing parser-errors.js ... OK
Testing parser-filter.js ... OK
---
Testing parser-tuple.js ... OK
Testing parser-weird-queries.js ... OK
Testing path-end-empty.js ... OK
Testing path-maxeditdistance.js ... FAILED
[ query `vec::iter`]==> Expected exactly 11 results but found 9 in 'others'
[ query `vec::iter`]==> Result not found in 'others': '{"path":"std::collections::VecDeque","name":"iter"}'
Diff of first error:
 {
-    "path": "std::collections::VecDeque",
+    "path": "std::vec::Vec",
-    "name": "iter",
+    "name": "from_iter",
 }
[ query `vec::iter`]==> Result not found in 'others': '{"path":"std::collections::VecDeque","name":"iter_mut"}'
Diff of first error:
 {
-    "path": "std::collections::VecDeque",
+    "path": "std::vec",
-    "name": "iter_mut",
+    "name": "IntoIter",
 }
Testing path-ordering.js ... FAILED
[ query `hashset::insert`]==> Result not found in 'others': '{"path":"std::collections::HashSet","name":"insert"}'
Diff of first error:
 {
-    "path": "std::collections::HashSet",
+    "path": "std::collections::hash_set",
     "name": "insert",
 }
[ query `hashset::insert`]==> Result not found in 'others': '{"path":"std::collections::HashSet","name":"get_or_insert"}'
Diff of first error:
 {
-    "path": "std::collections::HashSet",
+    "path": "std::collections::hash_set",
-    "name": "get_or_insert",
+    "name": "or_insert",
 }
[ query `hashset::insert`]==> Result not found in 'others': '{"path":"std::collections::HashSet","name":"get_or_insert_with"}'
Diff of first error:
 {
-    "path": "std::collections::HashSet",
+    "path": "std::collections::hash_set",
-    "name": "get_or_insert_with",
+    "name": "insert",
 }
Testing primitive.js ... OK
Testing println-typo.js ... OK
Testing quoted.js ... FAILED
==> Result not found in 'in_args': '{"path":"std::result::Result","name":"ok"}'
Diff of first error:
 {
     "path": "std::result::Result",
-    "name": "ok",
+    "name": "branch",
 }
==> Result not found in 'in_args': '{"path":"std::result::Result","name":"unwrap"}'
Diff of first error:
 {
     "path": "std::result::Result",
-    "name": "unwrap",
+    "name": "branch",
 }
Testing reference-shrink.js ... OK
Testing regex.js ... OK
Testing return-based-sort.js ... OK
Testing return-specific-literal.js ... FAILED
==> Result not found in 'returned': '{"path":"std::string::String","name":"new"}'
Diff of first error:
 {
-    "path": "std::string::String",
+    "path": "std::string",
     "name": "new",
 }
Testing return-specific.js ... FAILED
==> Result not found in 'returned': '{"path":"std::string::String","name":"new"}'
Diff of first error:
 {
-    "path": "std::string::String",
+    "path": "std::string",
     "name": "new",
 }
Testing search-by-number.js ... OK
Testing should-fail.js ... OK
Testing simd-type-signatures.js ... OK
Testing string-from_ut.js ... FAILED
==> Result not found in 'others': '{"path":"std::string::String","name":"from_utf8"}'
Diff of first error:
 {
-    "path": "std::string::String",
+    "path": "std::string",
     "name": "from_utf8",
 }
==> Result not found in 'others': '{"path":"std::string::String","name":"from_utf8"}'
Diff of first error:
 {
-    "path": "std::string::String",
+    "path": "alloc::string::String",
     "name": "from_utf8",
 }
==> Result not found in 'others': '{"path":"std::string::String","name":"from_utf8_lossy"}'
Diff of first error:
 {
-    "path": "std::string::String",
+    "path": "std::string",
-    "name": "from_utf8_lossy",
+    "name": "from_utf16",
 }
==> Result not found in 'others': '{"path":"std::string::String","name":"from_utf16_lossy"}'
Diff of first error:
 {
-    "path": "std::string::String",
+    "path": "alloc::string::String",
-    "name": "from_utf16_lossy",
+    "name": "from_utf16",
 }
==> Result not found in 'others': '{"path":"std::string::String","name":"from_utf8_unchecked"}'
Diff of first error:
 {
-    "path": "std::string::String",
+    "path": "std::string",
-    "name": "from_utf8_unchecked",
+    "name": "from_utf16be",
 }
Testing struct-vec.js ... OK
Testing trait-unbox.js ... FAILED
[ query `any -> result<box>`]==> Result not found in 'others': '{"path":"std::boxed::Box","name":"downcast"}'
Diff of first error:
 {
-    "path": "std::boxed::Box",
+    "path": "std::boxed",
     "name": "downcast",
 }
Testing transmute-fail.js ... OK
Testing transmute.js ... OK
Testing typed-query.js ... OK
Testing unbox-type-result.js ... OK
Testing vec-new.js ... FAILED
[ query `Vec::new`]==> Result not found in 'others': '{"path":"std::vec::Vec","name":"new"}'
Diff of first error:
 {
-    "path": "std::vec::Vec",
+    "path": "std::vec",
     "name": "new",
 }
[ query `Vec::new`]==> Result not found in 'others': '{"path":"std::vec::Vec","name":"new_in"}'
Diff of first error:
 {
-    "path": "std::vec::Vec",
+    "path": "alloc::vec::Vec",
-    "name": "new_in",
+    "name": "new",
 }
Testing vec-type-signatures.js ... FAILED
[ query `vec::intoiter<T> -> [T]`]==> Result not found in 'others': '{"path":"std::vec::IntoIter","name":"as_slice"}'
Diff of first error:
 {
     "path": "std::vec::IntoIter",
-    "name": "as_slice",
+    "name": "as_ref",
 }
[ query `vec::intoiter<T> -> [T]`]==> Result not found in 'others': '{"path":"std::vec::IntoIter","name":"as_mut_slice"}'
Diff of first error:
 {
     "path": "std::vec::IntoIter",
-    "name": "as_mut_slice",
+    "name": "as_ref",
 }
Testing write.js ... OK
Command `/usr/bin/node /checkout/src/tools/rustdoc-js/tester.js --crate-name std --resource-suffix 1.93.0 --doc-folder /checkout/obj/build/aarch64-unknown-linux-gnu/doc --test-folder /checkout/tests/rustdoc-js-std` failed with exit code 1
Created at: src/bootstrap/src/core/build_steps/test.rs:1029:27
Executed at: src/bootstrap/src/core/build_steps/test.rs:1056:17

Command has failed. Rerun with -v to see more details.
Bootstrap failed while executing `--stage 2 test --skip compiler --skip src`
Build completed unsuccessfully in 0:45:50
  local time: Sat Nov 29 18:04:24 UTC 2025
  network time: Sat, 29 Nov 2025 18:04:24 GMT
##[error]Process completed with exit code 1.

@lolbinarycat
Copy link
Contributor

It was working on #149460 that inspired this issue, and I agree that perhaps a substruct would be a better approach.

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

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

4 participants