Skip to content

Commit 92ef17a

Browse files
committed
syntax: Fix parsing of inherent traits
1 parent 2772b2e commit 92ef17a

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/libsyntax/parse/parser.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2436,7 +2436,8 @@ class parser {
24362436
!self.token_is_keyword(~"of", self.look_ahead(1)) &&
24372437
!self.token_is_keyword(~"for", self.look_ahead(1)) &&
24382438
self.look_ahead(1) != token::BINOP(token::SLASH) &&
2439-
self.look_ahead(1) != token::LT {
2439+
(self.look_ahead(1) != token::LT
2440+
|| (self.look_ahead(1) == token::LT && tps.is_not_empty())) {
24402441
24412442
// This is a new-style impl declaration.
24422443
ident = @~"__extensions__"; // XXX: clownshoes
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
enum option_<T> {
2+
none_,
3+
some_(T),
4+
}
5+
6+
impl<T> option_<T> {
7+
fn foo() -> bool { true }
8+
}
9+
10+
enum option__ {
11+
none__,
12+
some__(int)
13+
}
14+
15+
impl option__ {
16+
fn foo() -> bool { true }
17+
}
18+
19+
fn main() {
20+
}

0 commit comments

Comments
 (0)