This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +26
-0
lines changed
compiler/rustc_parse/src/parser
tests/ui/impl-trait/precise-capturing Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -895,6 +895,7 @@ impl<'a> Parser<'a> {
895895 }
896896
897897 // Attempt to keep parsing if it was an omitted separator.
898+ self . last_unexpected_token_span = None ;
898899 match f ( self ) {
899900 Ok ( t) => {
900901 // Parsed successfully, therefore most probably the code only
Original file line number Diff line number Diff line change 1+ // We used to fatal error without any useful diagnostic when we had an unexpected
2+ // token due to a strange interaction between the sequence parsing code and the
3+ // param/lifetime parsing code.
4+
5+ fn hello ( ) -> impl use < ' a { } > Sized { }
6+ //~^ ERROR expected one of `,` or `>`, found `{`
7+ //~| ERROR expected item, found `>`
8+
9+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error: expected one of `,` or `>`, found `{`
2+ --> $DIR/unexpected-token.rs:5:27
3+ |
4+ LL | fn hello() -> impl use<'a {}> Sized {}
5+ | ^ expected one of `,` or `>`
6+
7+ error: expected item, found `>`
8+ --> $DIR/unexpected-token.rs:5:29
9+ |
10+ LL | fn hello() -> impl use<'a {}> Sized {}
11+ | ^ expected item
12+ |
13+ = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html>
14+
15+ error: aborting due to 2 previous errors
16+
You can’t perform that action at this time.
0 commit comments