We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
impl (Trait) for Type
1 parent 943d7ad commit 36909c7Copy full SHA for 36909c7
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