Skip to content

Commit 141cc10

Browse files
taylordotfishdjc
authored andcommitted
Allow rustup doc to search for unions
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`.
1 parent c91692a commit 141cc10

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/cli/topical_doc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub(crate) fn local_path(root: &Path, topic: &str) -> Result<PathBuf> {
4747
// be changed.
4848
// https://github.com/rust-lang/rustup/issues/2076#issuecomment-546613036
4949
let keywords_top = vec!["keyword", "primitive", "macro"];
50-
let keywords_mod = ["fn", "struct", "trait", "enum", "type", "constant"];
50+
let keywords_mod = ["fn", "struct", "trait", "enum", "type", "constant", "union"];
5151

5252
let topic_vec: Vec<&str> = topic.split("::").collect();
5353
let work_path = topic_vec.iter().fold(PathBuf::new(), |acc, e| acc.join(e));

src/test/mock/topical_doc_data.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ static TEST_CASES: &[&[&str]] = &[
1919
&["usize", "std/primitive.usize.html"],
2020
&["eprintln", "std/macro.eprintln.html"],
2121
&["alloc::format", "alloc/macro.format.html"],
22+
&["std::mem::MaybeUninit", "std/mem/union.MaybeUninit.html"],
2223
];
2324

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

0 commit comments

Comments
 (0)