diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2017-01-25 22:01:11 +0200 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2017-02-25 17:07:59 +0200 |
| commit | e8d01ea4c76f6f3cb4f71dbff261355f825d12bb (patch) | |
| tree | bd71bb08ce70f9e7e9eebcddd20d084b12dbf96c /src/librustdoc | |
| parent | 1572bf104dbf65d58bd6b889fa46229c9b92d6f9 (diff) | |
| download | rust-e8d01ea4c76f6f3cb4f71dbff261355f825d12bb.tar.gz rust-e8d01ea4c76f6f3cb4f71dbff261355f825d12bb.zip | |
rustc: store type parameter defaults outside of ty::Generics.
Diffstat (limited to 'src/librustdoc')
| -rw-r--r-- | src/librustdoc/clean/mod.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 751ed7d443d..dc09fc2b8d3 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -596,14 +596,18 @@ impl Clean<TyParam> for hir::TyParam { } } -impl<'tcx> Clean<TyParam> for ty::TypeParameterDef<'tcx> { +impl<'tcx> Clean<TyParam> for ty::TypeParameterDef { fn clean(&self, cx: &DocContext) -> TyParam { cx.renderinfo.borrow_mut().external_typarams.insert(self.def_id, self.name.clean(cx)); TyParam { name: self.name.clean(cx), did: self.def_id, bounds: vec![], // these are filled in from the where-clauses - default: self.default.clean(cx), + default: if self.has_default { + Some(cx.tcx.item_type(self.def_id).clean(cx)) + } else { + None + } } } } @@ -965,7 +969,7 @@ impl Clean<Generics> for hir::Generics { } } -impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics<'tcx>, +impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics, &'a ty::GenericPredicates<'tcx>) { fn clean(&self, cx: &DocContext) -> Generics { use self::WherePredicate as WP; |
