mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 02:33:55 +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::TypedefItem(..) | clean::TraitItem(..) |
|
||||
clean::FunctionItem(..) | clean::ModuleItem(..) |
|
||||
clean::ForeignFunctionItem(..) | clean::VariantItem(..) => {
|
||||
clean::ForeignFunctionItem(..) => {
|
||||
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