diff options
| author | Eduard Burtescu <edy.burt@gmail.com> | 2016-07-22 18:56:22 +0300 |
|---|---|---|
| committer | Eduard Burtescu <edy.burt@gmail.com> | 2016-08-12 06:43:34 +0300 |
| commit | ef11d4e3c7040bf7cbb351dac8317a7957471b3b (patch) | |
| tree | 163620cf8be4fda40f6e91281db5d64e501f7edf /src/librustdoc | |
| parent | f0baec691f9bfcfc70d6f35b1a86f7cf204a7d4f (diff) | |
| download | rust-ef11d4e3c7040bf7cbb351dac8317a7957471b3b.tar.gz rust-ef11d4e3c7040bf7cbb351dac8317a7957471b3b.zip | |
rustc: add TyAnon (impl Trait) to the typesystem.
Diffstat (limited to 'src/librustdoc')
| -rw-r--r-- | src/librustdoc/clean/mod.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 37af778d555..73bc647fa9f 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1867,6 +1867,18 @@ impl<'tcx> Clean<Type> for ty::Ty<'tcx> { ty::TyParam(ref p) => Generic(p.name.to_string()), + ty::TyAnon(def_id, substs) => { + // Grab the "TraitA + TraitB" from `impl TraitA + TraitB`, + // by looking up the projections associated with the def_id. + let item_predicates = cx.tcx().lookup_predicates(def_id); + let substs = cx.tcx().lift(&substs).unwrap(); + let bounds = item_predicates.instantiate(cx.tcx(), substs); + let predicates = bounds.predicates.into_vec(); + ImplTrait(predicates.into_iter().filter_map(|predicate| { + predicate.to_opt_poly_trait_ref().clean(cx) + }).collect()) + } + ty::TyClosure(..) => Tuple(vec![]), // FIXME(pcwalton) ty::TyInfer(..) => panic!("TyInfer"), |
