diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2017-07-29 04:47:12 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2017-08-11 02:06:27 +0300 |
| commit | 7d21f21f71b9b4a8a0662a223c20db7a789f5637 (patch) | |
| tree | 1bec81f1d13749cf2b3b31e877715fdfef5da2cc /src/libsyntax/parse/parser.rs | |
| parent | 13d94d5fa8129a34f5c77a1bcd76983f5aed2434 (diff) | |
| download | rust-7d21f21f71b9b4a8a0662a223c20db7a789f5637.tar.gz rust-7d21f21f71b9b4a8a0662a223c20db7a789f5637.zip | |
syntax: Relax path grammar
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 7bf4c6799b3..9e36adf3d35 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -84,7 +84,7 @@ pub enum PathStyle { Expr, /// In other contexts, notably in types, no ambiguity exists and paths can be written /// without the disambiguator, e.g. `x<y>` - unambiguously a path. - /// Paths with disambiguators are rejected for now, but may be allowed in the future. + /// Paths with disambiguators are still accepted, `x::<Y>` - unambiguously a path too. Type, /// A path with generic arguments disallowed, e.g. `foo::bar::Baz`, used in imports, /// visibilities or attributes. @@ -1835,18 +1835,7 @@ impl<'a> Parser<'a> { && self.look_ahead(1, |t| is_args_start(t)) { // Generic arguments are found - `<`, `(`, `::<` or `::(`. let lo = self.span; - if self.eat(&token::ModSep) { - // These errors are not strictly necessary and may be removed in the future. - if style == PathStyle::Type { - let mut err = self.diagnostic().struct_span_err(self.prev_span, - "unnecessary path disambiguator"); - err.span_label(self.prev_span, "try removing `::`"); - err.emit(); - } else if self.token == token::OpenDelim(token::Paren) { - self.diagnostic().span_err(self.prev_span, - "`::` is not supported before parenthesized generic arguments") - } - } + self.eat(&token::ModSep); let parameters = if self.eat_lt() { // `<'a, T, A = U>` |
