We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents f7a2371 + 36909c7 commit a985bc5Copy full SHA for a985bc5
src/libsyntax/parse/parser.rs
@@ -3107,11 +3107,15 @@ pub impl Parser {
3107
// XXX: clownshoes
3108
let ident = special_idents::clownshoes_extensions;
3109
3110
+ // Special case: if the next identifier that follows is '(', don't
3111
+ // allow this to be parsed as a trait.
3112
+ let could_be_trait = *self.token != token::LPAREN;
3113
+
3114
// Parse the trait.
3115
let mut ty = self.parse_ty(false);
3116
3117
// Parse traits, if necessary.
- let opt_trait = if self.eat_keyword(&~"for") {
3118
+ let opt_trait = if could_be_trait && self.eat_keyword(&~"for") {
3119
// New-style trait. Reinterpret the type as a trait.
3120
let opt_trait_ref = match ty.node {
3121
ty_path(path, node_id) => {
0 commit comments