mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 11:48:30 +00:00
rustdoc: Fixup links to enum variants
Pages aren't emitted for enum variants, so whenever we're linking to an enum variant instead link to the parent enum instead. Closes #12289
This commit is contained in:
parent
74f3e0474b
commit
f0cb0ebc66
@ -565,9 +565,16 @@ impl DocFolder for Cache {
|
|||||||
clean::StructItem(..) | clean::EnumItem(..) |
|
clean::StructItem(..) | clean::EnumItem(..) |
|
||||||
clean::TypedefItem(..) | clean::TraitItem(..) |
|
clean::TypedefItem(..) | clean::TraitItem(..) |
|
||||||
clean::FunctionItem(..) | clean::ModuleItem(..) |
|
clean::FunctionItem(..) | clean::ModuleItem(..) |
|
||||||
clean::ForeignFunctionItem(..) | clean::VariantItem(..) => {
|
clean::ForeignFunctionItem(..) => {
|
||||||
self.paths.insert(item.id, (self.stack.clone(), shortty(&item)));
|
self.paths.insert(item.id, (self.stack.clone(), shortty(&item)));
|
||||||
}
|
}
|
||||||
|
// link variants to their parent enum because pages aren't emitted
|
||||||
|
// for each variant
|
||||||
|
clean::VariantItem(..) => {
|
||||||
|
let mut stack = self.stack.clone();
|
||||||
|
stack.pop();
|
||||||
|
self.paths.insert(item.id, (stack, "enum"));
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user