use rustc::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE};
use rustc::ty::subst::Substs;
use rustc::ty::{self, TyCtxt, Region, RegionVid, Ty, AdtKind};
+use rustc::ty::layout::VariantIdx;
use rustc::middle::stability;
use rustc::util::nodemap::{FxHashMap, FxHashSet};
use rustc_typeck::hir_ty_to_ty;
use rustc::infer::region_constraints::{RegionConstraintData, Constraint};
+use rustc_data_structures::indexed_vec::{IndexVec, Idx};
use std::collections::hash_map::Entry;
use std::fmt;
}
}
+impl<T: Clean<U>, U, V: Idx> Clean<IndexVec<V, U>> for IndexVec<V, T> {
+ fn clean(&self, cx: &DocContext) -> IndexVec<V, U> {
+ self.iter().map(|x| x.clean(cx)).collect()
+ }
+}
+
impl<T: Clean<U>, U> Clean<U> for P<T> {
fn clean(&self, cx: &DocContext) -> U {
(**self).clean(cx)
Predicate::RegionOutlives(ref pred) => pred.clean(cx),
Predicate::TypeOutlives(ref pred) => pred.clean(cx),
Predicate::Projection(ref pred) => pred.clean(cx),
- Predicate::WellFormed(ty) => {
- // This comes from `where Ty:` (i.e. no bounds) (see #53696).
- WherePredicate::BoundPredicate {
- ty: ty.clean(cx),
- bounds: vec![],
- }
- }
- Predicate::ObjectSafe(_) => panic!("not user writable"),
- Predicate::ClosureKind(..) => panic!("not user writable"),
+
+ Predicate::WellFormed(..) |
+ Predicate::ObjectSafe(..) |
+ Predicate::ClosureKind(..) |
Predicate::ConstEvaluatable(..) => panic!("not user writable"),
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
pub struct Enum {
- pub variants: Vec<Item>,
+ pub variants: IndexVec<VariantIdx, Item>,
pub generics: Generics,
pub variants_stripped: bool,
}
stability: self.stab.clean(cx),
deprecation: self.depr.clean(cx),
inner: EnumItem(Enum {
- variants: self.variants.clean(cx),
+ variants: self.variants.iter().map(|v| v.clean(cx)).collect(),
generics: self.generics.clean(cx),
variants_stripped: false,
}),