Skip to content

Commit

Permalink
Rollup merge of rust-lang#67113 - Centril:enum-vis-pretty-fix, r=davi…
Browse files Browse the repository at this point in the history
…dtwco

Print the visibility in `print_variant`.

r? @davidtwco
cc @dtolnay for `syn` awareness.
  • Loading branch information
tmandry committed Dec 9, 2019
2 parents 5c6941b + e9840d9 commit 3340a5b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/libsyntax/print/pprust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1518,6 +1518,7 @@ impl<'a> State<'a> {

crate fn print_variant(&mut self, v: &ast::Variant) {
self.head("");
self.print_visibility(&v.vis);
let generics = ast::Generics::default();
self.print_struct(&v.data, &generics, v.ident, v.span, false);
match v.disr_expr {
Expand Down
8 changes: 8 additions & 0 deletions src/test/pretty/enum-variant-vis.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// pp-exact

// Check that the visibility is printed on an enum variant.

fn main() { }

#[cfg(FALSE)]
enum Foo { pub V, }

0 comments on commit 3340a5b

Please sign in to comment.