Separate supertrait collection from processing a TraitDef. This allows

us to construct trait-references and do other things without forcing a
full evaluation of the supertraits. One downside of this scheme is that
we must invoke `ensure_super_predicates` before using any construct that
might require knowing about the super-predicates.
This commit is contained in:
Niko Matsakis 2015-02-24 09:24:42 -05:00
parent 4ee002a17c
commit bc9ae36dba
23 changed files with 486 additions and 416 deletions

View file

@ -165,14 +165,12 @@ pub fn build_external_trait(cx: &DocContext, tcx: &ty::ctxt,
_ => unreachable!()
}
});
let trait_def = ty::lookup_trait_def(tcx, did);
let predicates = ty::lookup_predicates(tcx, did);
let bounds = trait_def.bounds.clean(cx);
clean::Trait {
unsafety: def.unsafety,
generics: (&def.generics, &predicates, subst::TypeSpace).clean(cx),
items: items.collect(),
bounds: bounds,
bounds: vec![], // supertraits can be found in the list of predicates
}
}