Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libsyntax: forbid visibility modifiers for enum variants #28440

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5210,13 +5210,10 @@ impl<'a> Parser<'a> {
let variant_attrs = self.parse_outer_attributes();
let vlo = self.span.lo;

let vis = try!(self.parse_visibility());

let ident;
let kind;
let mut args = Vec::new();
let mut disr_expr = None;
ident = try!(self.parse_ident());
let ident = try!(self.parse_ident());
if try!(self.eat(&token::OpenDelim(token::Brace)) ){
// Parse a struct variant.
all_nullary = false;
Expand Down Expand Up @@ -5258,7 +5255,7 @@ impl<'a> Parser<'a> {
kind: kind,
id: ast::DUMMY_NODE_ID,
disr_expr: disr_expr,
vis: vis,
vis: Inherited,
};
variants.push(P(spanned(vlo, self.last_span.hi, vr)));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
Expand All @@ -8,16 +8,12 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use zoo::bird::{duck, goose};

mod zoo {
pub enum bird {
pub duck, //~ ERROR: unnecessary `pub` visibility
goose
}
enum bird {
pub duck, //~ ERROR: expected identifier, found keyword `pub`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test will not pass because of #28439 I think.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can I run this this test fater than make -j8 check?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’d suggest waiting for travis build to finish for now.

Otherwise the fastest way without editing makefiles is to do make -j8 check-stage2-cfail TESTNAME=issue-28433 I think.

goose
}


fn main() {
let y = goose;
let y = bird::goose;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
// except according to those terms.

struct A { pub i: isize }
pub enum C { pub Variant } //~ ERROR: unnecessary `pub`

pub trait E {
fn foo(&self);
Expand Down