File tree Expand file tree Collapse file tree 3 files changed +38
-0
lines changed Expand file tree Collapse file tree 3 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -7716,6 +7716,9 @@ impl<'a> Parser<'a> {
77167716 let ret = f ( self ) ;
77177717 let last_token = if self . token_cursor . stack . len ( ) == prev {
77187718 & mut self . token_cursor . frame . last_token
7719+ } else if self . token_cursor . stack . is_empty ( ) { //&& !self.unclosed_delims.is_empty() {
7720+ // This can happen with mismatched delimiters (#62881)
7721+ return Ok ( ( ret?, TokenStream :: new ( vec ! [ ] ) ) ) ;
77197722 } else {
77207723 & mut self . token_cursor . stack [ prev] . last_token
77217724 } ;
Original file line number Diff line number Diff line change 1+ fn main ( ) { }
2+
3+ fn f( ) -> isize { fn f ( ) -> isize { } pub f<
4+ //~^ ERROR missing `fn` or `struct` for function or struct definition
5+ //~| ERROR mismatched types
6+ //~ ERROR this file contains an un-closed delimiter
Original file line number Diff line number Diff line change 1+ error: this file contains an un-closed delimiter
2+ --> $DIR/issue-62881.rs:6:53
3+ |
4+ LL | fn f() -> isize { fn f() -> isize {} pub f<
5+ | - un-closed delimiter
6+ ...
7+ LL |
8+ | ^
9+
10+ error: missing `fn` or `struct` for function or struct definition
11+ --> $DIR/issue-62881.rs:3:41
12+ |
13+ LL | fn f() -> isize { fn f() -> isize {} pub f<
14+ | ^
15+
16+ error[E0308]: mismatched types
17+ --> $DIR/issue-62881.rs:3:29
18+ |
19+ LL | fn f() -> isize { fn f() -> isize {} pub f<
20+ | - ^^^^^ expected isize, found ()
21+ | |
22+ | this function's body doesn't return
23+ |
24+ = note: expected type `isize`
25+ found type `()`
26+
27+ error: aborting due to 3 previous errors
28+
29+ For more information about this error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments