diff options
| author | bors <bors@rust-lang.org> | 2020-07-09 21:32:02 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-07-09 21:32:02 +0000 |
| commit | e59b08e62ea691916d2f063cac5aab4634128022 (patch) | |
| tree | 7bafe998869c457ebaa9f82179f49c37baf7a551 /src/librustc_parse/parser | |
| parent | 5db778affee7c6600c8e7a177c48282dab3f6292 (diff) | |
| parent | 9353e21bfdea148e910b2530270a3418db836bf3 (diff) | |
Auto merge of #74195 - Manishearth:rollup-h3m0sl8, r=Manishearth
Rollup of 14 pull requests Successful merges: - #73292 (Fixing broken link for the Eq trait) - #73791 (Allow for parentheses after macro intra-doc-links) - #74070 ( Use for<'tcx> fn pointers in Providers, instead of having Providers<'tcx>.) - #74077 (Use relative path for local links to primitives) - #74079 (Eliminate confusing "globals" terminology.) - #74107 (Hide `&mut self` methods from Deref in sidebar if there are no `DerefMut` impl for the type.) - #74136 (Fix broken link in rustdocdoc) - #74137 (Update cargo) - #74142 (Liballoc use vec instead of vector) - #74143 (Try remove unneeded ToString import in liballoc slice) - #74146 (update miri) - #74150 (Avoid "blacklist") - #74184 (Add docs for intra-doc-links) - #74188 (Tweak `::` -> `:` typo heuristic and reduce verbosity) Failed merges: - #74122 (Start-up clean-up) - #74127 (Avoid "whitelist") r? @ghost
Diffstat (limited to 'src/librustc_parse/parser')
| -rw-r--r-- | src/librustc_parse/parser/diagnostics.rs | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/librustc_parse/parser/diagnostics.rs b/src/librustc_parse/parser/diagnostics.rs index 7822c097390..3244b35e89b 100644 --- a/src/librustc_parse/parser/diagnostics.rs +++ b/src/librustc_parse/parser/diagnostics.rs @@ -346,13 +346,16 @@ impl<'a> Parser<'a> { if allow_unstable { // Give extra information about type ascription only if it's a nightly compiler. err.note( - "`#![feature(type_ascription)]` lets you annotate an expression with a \ - type: `<expr>: <type>`", - ); - err.note( - "see issue #23416 <https://github.com/rust-lang/rust/issues/23416> \ - for more information", + "`#![feature(type_ascription)]` lets you annotate an expression with a type: \ + `<expr>: <type>`", ); + if !likely_path { + // Avoid giving too much info when it was likely an unrelated typo. + err.note( + "see issue #23416 <https://github.com/rust-lang/rust/issues/23416> \ + for more information", + ); + } } } } @@ -1161,8 +1164,10 @@ impl<'a> Parser<'a> { } && !self.token.is_reserved_ident() && // v `foo:bar(baz)` self.look_ahead(1, |t| t == &token::OpenDelim(token::Paren)) - || self.look_ahead(1, |t| t == &token::Lt) && // `foo:bar<baz` - self.look_ahead(2, |t| t.is_ident()) + || self.look_ahead(1, |t| t == &token::OpenDelim(token::Brace)) // `foo:bar {` + || self.look_ahead(1, |t| t == &token::Colon) && // `foo:bar::<baz` + self.look_ahead(2, |t| t == &token::Lt) && + self.look_ahead(3, |t| t.is_ident()) || self.look_ahead(1, |t| t == &token::Colon) && // `foo:bar:baz` self.look_ahead(2, |t| t.is_ident()) || self.look_ahead(1, |t| t == &token::ModSep) |
