Skip to content

Commit

Permalink
Allow rustup doc to search for unions
Browse files Browse the repository at this point in the history
Add "union" to the list of prefixes used when searching for
documentation.

Fixes #4002, where `rustup doc` fails to find the documentation for
`std::mem::MaybeUninit`.
  • Loading branch information
taylordotfish authored and djc committed Aug 24, 2024
1 parent c91692a commit 141cc10
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/cli/topical_doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub(crate) fn local_path(root: &Path, topic: &str) -> Result<PathBuf> {
// be changed.
// https://github.com/rust-lang/rustup/issues/2076#issuecomment-546613036
let keywords_top = vec!["keyword", "primitive", "macro"];
let keywords_mod = ["fn", "struct", "trait", "enum", "type", "constant"];
let keywords_mod = ["fn", "struct", "trait", "enum", "type", "constant", "union"];

let topic_vec: Vec<&str> = topic.split("::").collect();
let work_path = topic_vec.iter().fold(PathBuf::new(), |acc, e| acc.join(e));
Expand Down
1 change: 1 addition & 0 deletions src/test/mock/topical_doc_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ static TEST_CASES: &[&[&str]] = &[
&["usize", "std/primitive.usize.html"],
&["eprintln", "std/macro.eprintln.html"],
&["alloc::format", "alloc/macro.format.html"],
&["std::mem::MaybeUninit", "std/mem/union.MaybeUninit.html"],
];

fn repath(origin: &str) -> String {
Expand Down

0 comments on commit 141cc10

Please sign in to comment.