Skip to content

Commit a18f43f

Browse files
committed
Fix unclosed boxes in pretty printing of TraitAlias
1 parent dd3ac41 commit a18f43f

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

compiler/rustc_ast_pretty/src/pprust/state.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1354,9 +1354,7 @@ impl<'a> State<'a> {
13541354
self.bclose(item.span, empty);
13551355
}
13561356
ast::ItemKind::TraitAlias(ref generics, ref bounds) => {
1357-
self.head("");
1358-
self.print_visibility(&item.vis);
1359-
self.word_nbsp("trait");
1357+
self.head(visibility_qualified(&item.vis, "trait"));
13601358
self.print_ident(item.ident);
13611359
self.print_generic_params(&generics.params);
13621360
let mut real_bounds = Vec::with_capacity(bounds.len());
@@ -1374,6 +1372,8 @@ impl<'a> State<'a> {
13741372
self.print_type_bounds("=", &real_bounds);
13751373
self.print_where_clause(&generics.where_clause);
13761374
self.word(";");
1375+
self.end(); // end inner head-block
1376+
self.end(); // end outer head-block
13771377
}
13781378
ast::ItemKind::MacCall(ref mac) => {
13791379
self.print_mac(mac);

compiler/rustc_hir_pretty/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -705,9 +705,7 @@ impl<'a> State<'a> {
705705
self.bclose(item.span);
706706
}
707707
hir::ItemKind::TraitAlias(ref generics, ref bounds) => {
708-
self.head("");
709-
self.print_visibility(&item.vis);
710-
self.word_nbsp("trait");
708+
self.head(visibility_qualified(&item.vis, "trait"));
711709
self.print_ident(item.ident);
712710
self.print_generic_params(&generics.params);
713711
let mut real_bounds = Vec::with_capacity(bounds.len());
@@ -725,6 +723,8 @@ impl<'a> State<'a> {
725723
self.print_bounds("=", real_bounds);
726724
self.print_where_clause(&generics.where_clause);
727725
self.word(";");
726+
self.end(); // end inner head-block
727+
self.end(); // end outer head-block
728728
}
729729
}
730730
self.ann.post(self, AnnNode::Item(item))

src/test/ui/macros/stringify.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ fn test_item() {
589589
stringify_item!(
590590
pub trait Trait<T> = Sized where T: 'a;
591591
),
592-
"", // FIXME
592+
"pub trait Trait<T> = Sized where T: 'a;",
593593
);
594594

595595
// ItemKind::Impl

0 commit comments

Comments
 (0)