about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-01-21 02:21:55 +0100
committerGitHub <noreply@github.com>2019-01-21 02:21:55 +0100
commit627e001a722d0aa1c8db0523ed26c25f775570f4 (patch)
tree68868cfffd85d93898d439d84375012580dc7655 /src/libsyntax/parse/parser.rs
parentebc70e2e9ecdd0920c5e78f53ed694f1c050c5ed (diff)
parent2ab6cefccfe3c5f2c97bf8bcab080a26089257e2 (diff)
downloadrust-627e001a722d0aa1c8db0523ed26c25f775570f4.tar.gz
rust-627e001a722d0aa1c8db0523ed26c25f775570f4.zip
Rollup merge of #57768 - estebank:type-args-sugg, r=zackmdavis
Continue parsing after parent type args and suggest using angle brackets

```
error[E0214]: parenthesized parameters may only be used with a trait
--> $DIR/E0214.rs:2:15
   |
LL |     let v: Vec(&str) = vec!["foo"];
   |               ^^^^^^
   |               |
   |               only traits may use parentheses
   |               help: use angle brackets instead: `<&str>`
```

r? @zackmdavis
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
-rw-r--r--src/libsyntax/parse/parser.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 7e15b231276..e09b7a9dd7b 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -2176,11 +2176,11 @@ impl<'a> Parser<'a> {
               style != PathStyle::Mod && self.check(&token::ModSep)
                                       && self.look_ahead(1, |t| is_args_start(t)) {
             // Generic arguments are found - `<`, `(`, `::<` or `::(`.
-            let lo = self.span;
             if self.eat(&token::ModSep) && style == PathStyle::Type && enable_warning {
                 self.diagnostic().struct_span_warn(self.prev_span, "unnecessary path disambiguator")
                                  .span_label(self.prev_span, "try removing `::`").emit();
             }
+            let lo = self.span;
 
             let args = if self.eat_lt() {
                 // `<'a, T, A = U>`