Skip to content

Commit

Permalink
add hir printing
Browse files Browse the repository at this point in the history
  • Loading branch information
basil-cow committed Feb 7, 2020
1 parent ab6ea2b commit bf82582
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/librustc_hir/print.rs
Expand Up @@ -454,14 +454,17 @@ impl<'a> State<'a> {
fn print_associated_type(
&mut self,
ident: ast::Ident,
generics: &hir::Generics<'_>,
bounds: Option<hir::GenericBounds<'_>>,
ty: Option<&hir::Ty<'_>>,
) {
self.word_space("type");
self.print_ident(ident);
self.print_generic_params(&generics.params);
if let Some(bounds) = bounds {
self.print_bounds(":", bounds);
}
self.print_where_clause(&generics.where_clause);
if let Some(ty) = ty {
self.s.space();
self.word_space("=");
Expand Down Expand Up @@ -902,6 +905,7 @@ impl<'a> State<'a> {
hir::TraitItemKind::Type(ref bounds, ref default) => {
self.print_associated_type(
ti.ident,
&ti.generics,
Some(bounds),
default.as_ref().map(|ty| &**ty),
);
Expand Down Expand Up @@ -930,7 +934,7 @@ impl<'a> State<'a> {
self.ann.nested(self, Nested::Body(body));
}
hir::ImplItemKind::TyAlias(ref ty) => {
self.print_associated_type(ii.ident, None, Some(ty));
self.print_associated_type(ii.ident, &ii.generics, None, Some(ty));
}
hir::ImplItemKind::OpaqueTy(bounds) => {
self.word_space("type");
Expand Down

0 comments on commit bf82582

Please sign in to comment.