diff --git a/compiler/rustc_ast_pretty/src/pprust/state.rs b/compiler/rustc_ast_pretty/src/pprust/state.rs index b87dd449a1e57..b5b87c0b48af1 100644 --- a/compiler/rustc_ast_pretty/src/pprust/state.rs +++ b/compiler/rustc_ast_pretty/src/pprust/state.rs @@ -1354,9 +1354,7 @@ impl<'a> State<'a> { self.bclose(item.span, empty); } ast::ItemKind::TraitAlias(ref generics, ref bounds) => { - self.head(""); - self.print_visibility(&item.vis); - self.word_nbsp("trait"); + self.head(visibility_qualified(&item.vis, "trait")); self.print_ident(item.ident); self.print_generic_params(&generics.params); let mut real_bounds = Vec::with_capacity(bounds.len()); @@ -1374,6 +1372,8 @@ impl<'a> State<'a> { self.print_type_bounds("=", &real_bounds); self.print_where_clause(&generics.where_clause); self.word(";"); + self.end(); // end inner head-block + self.end(); // end outer head-block } ast::ItemKind::MacCall(ref mac) => { self.print_mac(mac); diff --git a/compiler/rustc_hir_pretty/src/lib.rs b/compiler/rustc_hir_pretty/src/lib.rs index fb11aaf24c4b8..ad47c69652035 100644 --- a/compiler/rustc_hir_pretty/src/lib.rs +++ b/compiler/rustc_hir_pretty/src/lib.rs @@ -705,9 +705,7 @@ impl<'a> State<'a> { self.bclose(item.span); } hir::ItemKind::TraitAlias(ref generics, ref bounds) => { - self.head(""); - self.print_visibility(&item.vis); - self.word_nbsp("trait"); + self.head(visibility_qualified(&item.vis, "trait")); self.print_ident(item.ident); self.print_generic_params(&generics.params); let mut real_bounds = Vec::with_capacity(bounds.len()); @@ -725,6 +723,8 @@ impl<'a> State<'a> { self.print_bounds("=", real_bounds); self.print_where_clause(&generics.where_clause); self.word(";"); + self.end(); // end inner head-block + self.end(); // end outer head-block } } self.ann.post(self, AnnNode::Item(item)) diff --git a/src/test/ui/macros/stringify.rs b/src/test/ui/macros/stringify.rs index 343a26c14a9b0..36e01a7508f34 100644 --- a/src/test/ui/macros/stringify.rs +++ b/src/test/ui/macros/stringify.rs @@ -589,7 +589,7 @@ fn test_item() { stringify_item!( pub trait Trait = Sized where T: 'a; ), - "", // FIXME + "pub trait Trait = Sized where T: 'a;", ); // ItemKind::Impl