Skip to content

Commit

Permalink
auto merge of #5616 : pcwalton/rust/parenthesized-trait, r=brson
Browse files Browse the repository at this point in the history
  • Loading branch information
bors committed Mar 29, 2013
2 parents f7a2371 + 36909c7 commit a985bc5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3107,11 +3107,15 @@ pub impl Parser {
// XXX: clownshoes
let ident = special_idents::clownshoes_extensions;

// Special case: if the next identifier that follows is '(', don't
// allow this to be parsed as a trait.
let could_be_trait = *self.token != token::LPAREN;

// Parse the trait.
let mut ty = self.parse_ty(false);

// Parse traits, if necessary.
let opt_trait = if self.eat_keyword(&~"for") {
let opt_trait = if could_be_trait && self.eat_keyword(&~"for") {
// New-style trait. Reinterpret the type as a trait.
let opt_trait_ref = match ty.node {
ty_path(path, node_id) => {
Expand Down

0 comments on commit a985bc5

Please sign in to comment.