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:
Alex Crichton 2014-02-16 14:35:13 -08:00
parent 74f3e0474b
commit f0cb0ebc66

View File

@ -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"));
}
_ => {}
}