remove duplicated diagnostic for unclosed delimiter
This commit is contained in:
parent
f01d0c02e7
commit
65ad5f8de7
@ -34,7 +34,7 @@ fn parse_token_trees(&mut self, is_delimited: bool) -> PResult<'a, TokenStream>
|
||||
let mut buf = Vec::new();
|
||||
loop {
|
||||
match self.token.kind {
|
||||
token::OpenDelim(delim) => buf.push(self.parse_token_tree_open_delim(delim)),
|
||||
token::OpenDelim(delim) => buf.push(self.parse_token_tree_open_delim(delim)?),
|
||||
token::CloseDelim(delim) => {
|
||||
return if is_delimited {
|
||||
Ok(TokenStream::new(buf))
|
||||
@ -43,10 +43,11 @@ fn parse_token_trees(&mut self, is_delimited: bool) -> PResult<'a, TokenStream>
|
||||
};
|
||||
}
|
||||
token::Eof => {
|
||||
if is_delimited {
|
||||
self.eof_err().emit();
|
||||
}
|
||||
return Ok(TokenStream::new(buf));
|
||||
return if is_delimited {
|
||||
Err(self.eof_err())
|
||||
} else {
|
||||
Ok(TokenStream::new(buf))
|
||||
};
|
||||
}
|
||||
_ => {
|
||||
// Get the next normal token. This might require getting multiple adjacent
|
||||
@ -98,7 +99,7 @@ fn eof_err(&mut self) -> PErr<'a> {
|
||||
err
|
||||
}
|
||||
|
||||
fn parse_token_tree_open_delim(&mut self, open_delim: Delimiter) -> TokenTree {
|
||||
fn parse_token_tree_open_delim(&mut self, open_delim: Delimiter) -> PResult<'a, TokenTree> {
|
||||
// The span for beginning of the delimited section
|
||||
let pre_span = self.token.span;
|
||||
|
||||
@ -107,7 +108,7 @@ fn parse_token_tree_open_delim(&mut self, open_delim: Delimiter) -> TokenTree {
|
||||
// Parse the token trees within the delimiters.
|
||||
// We stop at any delimiter so we can try to recover if the user
|
||||
// uses an incorrect delimiter.
|
||||
let tts = self.parse_token_trees(/* is_delimited */ true).unwrap();
|
||||
let tts = self.parse_token_trees(/* is_delimited */ true)?;
|
||||
|
||||
// Expand to cover the entire delimited token tree
|
||||
let delim_span = DelimSpan::from_pair(pre_span, self.token.span);
|
||||
@ -190,7 +191,7 @@ fn parse_token_tree_open_delim(&mut self, open_delim: Delimiter) -> TokenTree {
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
||||
TokenTree::Delimited(delim_span, open_delim, tts)
|
||||
Ok(TokenTree::Delimited(delim_span, open_delim, tts))
|
||||
}
|
||||
|
||||
fn close_delim_err(&mut self, delim: Delimiter) -> PErr<'a> {
|
||||
|
@ -8,25 +8,5 @@ LL | fn f(){(print!(á
|
||||
| |unclosed delimiter
|
||||
| unclosed delimiter
|
||||
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-104897.rs:5:18
|
||||
|
|
||||
LL | fn f(){(print!(á
|
||||
| -- - ^
|
||||
| || |
|
||||
| || unclosed delimiter
|
||||
| |unclosed delimiter
|
||||
| unclosed delimiter
|
||||
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-104897.rs:5:18
|
||||
|
|
||||
LL | fn f(){(print!(á
|
||||
| -- - ^
|
||||
| || |
|
||||
| || unclosed delimiter
|
||||
| |unclosed delimiter
|
||||
| unclosed delimiter
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -8,25 +8,5 @@ LL | fn f(){(print!(á
|
||||
| |unclosed delimiter
|
||||
| unclosed delimiter
|
||||
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/unused_parens_multibyte_recovery.rs:10:17
|
||||
|
|
||||
LL | fn f(){(print!(á
|
||||
| -- - ^
|
||||
| || |
|
||||
| || unclosed delimiter
|
||||
| |unclosed delimiter
|
||||
| unclosed delimiter
|
||||
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/unused_parens_multibyte_recovery.rs:10:17
|
||||
|
|
||||
LL | fn f(){(print!(á
|
||||
| -- - ^
|
||||
| || |
|
||||
| || unclosed delimiter
|
||||
| |unclosed delimiter
|
||||
| unclosed delimiter
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -8,25 +8,5 @@ LL | fn a(){{{
|
||||
| |unclosed delimiter
|
||||
| unclosed delimiter
|
||||
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-107423-unused-delim-only-one-no-pair.rs:7:11
|
||||
|
|
||||
LL | fn a(){{{
|
||||
| --- ^
|
||||
| |||
|
||||
| ||unclosed delimiter
|
||||
| |unclosed delimiter
|
||||
| unclosed delimiter
|
||||
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-107423-unused-delim-only-one-no-pair.rs:7:11
|
||||
|
|
||||
LL | fn a(){{{
|
||||
| --- ^
|
||||
| |||
|
||||
| ||unclosed delimiter
|
||||
| |unclosed delimiter
|
||||
| unclosed delimiter
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -8,15 +8,5 @@ LL | x: [u8; R
|
||||
| |
|
||||
| unclosed delimiter
|
||||
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-103451.rs:4:15
|
||||
|
|
||||
LL | struct S {
|
||||
| - unclosed delimiter
|
||||
LL | x: [u8; R
|
||||
| - ^
|
||||
| |
|
||||
| unclosed delimiter
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -1,21 +1,3 @@
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-81804.rs:6:11
|
||||
|
|
||||
LL | fn p([=(}
|
||||
| -- ^
|
||||
| ||
|
||||
| |unclosed delimiter
|
||||
| unclosed delimiter
|
||||
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-81804.rs:6:11
|
||||
|
|
||||
LL | fn p([=(}
|
||||
| -- ^
|
||||
| ||
|
||||
| |unclosed delimiter
|
||||
| unclosed delimiter
|
||||
|
||||
error: mismatched closing delimiter: `}`
|
||||
--> $DIR/issue-81804.rs:6:8
|
||||
|
|
||||
@ -24,5 +6,14 @@ LL | fn p([=(}
|
||||
| |
|
||||
| unclosed delimiter
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-81804.rs:6:11
|
||||
|
|
||||
LL | fn p([=(}
|
||||
| -- ^
|
||||
| ||
|
||||
| |unclosed delimiter
|
||||
| unclosed delimiter
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -1,23 +1,3 @@
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-81827.rs:10:27
|
||||
|
|
||||
LL | fn r()->i{0|{#[cfg(r(0{]0
|
||||
| - - - ^
|
||||
| | | |
|
||||
| | | missing open `[` for this delimiter
|
||||
| | unclosed delimiter
|
||||
| unclosed delimiter
|
||||
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-81827.rs:10:27
|
||||
|
|
||||
LL | fn r()->i{0|{#[cfg(r(0{]0
|
||||
| - - - ^
|
||||
| | | |
|
||||
| | | missing open `[` for this delimiter
|
||||
| | unclosed delimiter
|
||||
| unclosed delimiter
|
||||
|
||||
error: mismatched closing delimiter: `]`
|
||||
--> $DIR/issue-81827.rs:10:23
|
||||
|
|
||||
@ -27,5 +7,15 @@ LL | fn r()->i{0|{#[cfg(r(0{]0
|
||||
| | unclosed delimiter
|
||||
| closing delimiter possibly meant for this
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-81827.rs:10:27
|
||||
|
|
||||
LL | fn r()->i{0|{#[cfg(r(0{]0
|
||||
| - - - ^
|
||||
| | | |
|
||||
| | | missing open `[` for this delimiter
|
||||
| | unclosed delimiter
|
||||
| unclosed delimiter
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -9,49 +9,5 @@ LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s
|
||||
| | | unclosed delimiter
|
||||
| unclosed delimiter unclosed delimiter
|
||||
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-62554.rs:5:89
|
||||
|
|
||||
LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 {
|
||||
| - - - - - ^
|
||||
| | | | | |
|
||||
| | | | | unclosed delimiter
|
||||
| | | | unclosed delimiter
|
||||
| | | unclosed delimiter
|
||||
| unclosed delimiter unclosed delimiter
|
||||
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-62554.rs:5:89
|
||||
|
|
||||
LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 {
|
||||
| - - - - - ^
|
||||
| | | | | |
|
||||
| | | | | unclosed delimiter
|
||||
| | | | unclosed delimiter
|
||||
| | | unclosed delimiter
|
||||
| unclosed delimiter unclosed delimiter
|
||||
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-62554.rs:5:89
|
||||
|
|
||||
LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 {
|
||||
| - - - - - ^
|
||||
| | | | | |
|
||||
| | | | | unclosed delimiter
|
||||
| | | | unclosed delimiter
|
||||
| | | unclosed delimiter
|
||||
| unclosed delimiter unclosed delimiter
|
||||
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-62554.rs:5:89
|
||||
|
|
||||
LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 {
|
||||
| - - - - - ^
|
||||
| | | | | |
|
||||
| | | | | unclosed delimiter
|
||||
| | | | unclosed delimiter
|
||||
| | | unclosed delimiter
|
||||
| unclosed delimiter unclosed delimiter
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -10,29 +10,5 @@ LL |
|
||||
LL | fn main() {}
|
||||
| ^
|
||||
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-62894.rs:6:14
|
||||
|
|
||||
LL | fn f() { assert_eq!(f(), (), assert_eq!(assert_eq!
|
||||
| - - - unclosed delimiter
|
||||
| | |
|
||||
| | unclosed delimiter
|
||||
| unclosed delimiter
|
||||
LL |
|
||||
LL | fn main() {}
|
||||
| ^
|
||||
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-62894.rs:6:14
|
||||
|
|
||||
LL | fn f() { assert_eq!(f(), (), assert_eq!(assert_eq!
|
||||
| - - - unclosed delimiter
|
||||
| | |
|
||||
| | unclosed delimiter
|
||||
| unclosed delimiter
|
||||
LL |
|
||||
LL | fn main() {}
|
||||
| ^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// ignore-tidy-trailing-newlines
|
||||
// error-pattern: aborting due to 4 previous errors
|
||||
// error-pattern: aborting due to 3 previous errors
|
||||
|
||||
fn main() {}
|
||||
|
||||
|
@ -1,29 +1,3 @@
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-62973.rs:8:2
|
||||
|
|
||||
LL | fn p() { match s { v, E { [) {) }
|
||||
| - - - - missing open `(` for this delimiter
|
||||
| | | |
|
||||
| | | missing open `(` for this delimiter
|
||||
| | unclosed delimiter
|
||||
| unclosed delimiter
|
||||
LL |
|
||||
LL |
|
||||
| ^
|
||||
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-62973.rs:8:2
|
||||
|
|
||||
LL | fn p() { match s { v, E { [) {) }
|
||||
| - - - - missing open `(` for this delimiter
|
||||
| | | |
|
||||
| | | missing open `(` for this delimiter
|
||||
| | unclosed delimiter
|
||||
| unclosed delimiter
|
||||
LL |
|
||||
LL |
|
||||
| ^
|
||||
|
||||
error: mismatched closing delimiter: `)`
|
||||
--> $DIR/issue-62973.rs:6:27
|
||||
|
|
||||
@ -40,5 +14,18 @@ LL | fn p() { match s { v, E { [) {) }
|
||||
| |
|
||||
| unclosed delimiter
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-62973.rs:8:2
|
||||
|
|
||||
LL | fn p() { match s { v, E { [) {) }
|
||||
| - - - - missing open `(` for this delimiter
|
||||
| | | |
|
||||
| | | missing open `(` for this delimiter
|
||||
| | unclosed delimiter
|
||||
| unclosed delimiter
|
||||
LL |
|
||||
LL |
|
||||
| ^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
@ -1,3 +1,11 @@
|
||||
error: mismatched closing delimiter: `]`
|
||||
--> $DIR/issue-63116.rs:3:14
|
||||
|
|
||||
LL | impl W <s(f;Y(;]
|
||||
| ^ ^ mismatched closing delimiter
|
||||
| |
|
||||
| unclosed delimiter
|
||||
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-63116.rs:3:18
|
||||
|
|
||||
@ -7,13 +15,5 @@ LL | impl W <s(f;Y(;]
|
||||
| | missing open `[` for this delimiter
|
||||
| unclosed delimiter
|
||||
|
||||
error: mismatched closing delimiter: `]`
|
||||
--> $DIR/issue-63116.rs:3:14
|
||||
|
|
||||
LL | impl W <s(f;Y(;]
|
||||
| ^ ^ mismatched closing delimiter
|
||||
| |
|
||||
| unclosed delimiter
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
// error-pattern: this file contains an unclosed delimiter
|
||||
// error-pattern: aborting due to 2 previous errors
|
||||
// error-pattern: aborting due to previous error
|
||||
fn i(n{...,f #
|
||||
|
@ -7,14 +7,5 @@ LL | fn i(n{...,f #
|
||||
| | unclosed delimiter
|
||||
| unclosed delimiter
|
||||
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-63135.rs:3:16
|
||||
|
|
||||
LL | fn i(n{...,f #
|
||||
| - - ^
|
||||
| | |
|
||||
| | unclosed delimiter
|
||||
| unclosed delimiter
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -1,21 +1,3 @@
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:23:65
|
||||
|
|
||||
LL | V = [PhantomData; { [ () ].len() ].len() as isize,
|
||||
| - missing open `[` for this delimiter
|
||||
...
|
||||
LL | V = [Vec::new; { [].len() ].len() as isize,
|
||||
| - missing open `[` for this delimiter
|
||||
...
|
||||
LL | mod c {
|
||||
| - unclosed delimiter
|
||||
LL | enum Bug {
|
||||
LL | V = [Vec::new; { [0].len() ].len() as isize,
|
||||
| - missing open `[` for this delimiter
|
||||
...
|
||||
LL | fn main() {}
|
||||
| ^
|
||||
|
||||
error: mismatched closing delimiter: `]`
|
||||
--> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:5:27
|
||||
|
|
||||
@ -43,5 +25,23 @@ LL | V = [Vec::new; { [0].len() ].len() as isize,
|
||||
| | unclosed delimiter
|
||||
| closing delimiter possibly meant for this
|
||||
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:23:65
|
||||
|
|
||||
LL | V = [PhantomData; { [ () ].len() ].len() as isize,
|
||||
| - missing open `[` for this delimiter
|
||||
...
|
||||
LL | V = [Vec::new; { [].len() ].len() as isize,
|
||||
| - missing open `[` for this delimiter
|
||||
...
|
||||
LL | mod c {
|
||||
| - unclosed delimiter
|
||||
LL | enum Bug {
|
||||
LL | V = [Vec::new; { [0].len() ].len() as isize,
|
||||
| - missing open `[` for this delimiter
|
||||
...
|
||||
LL | fn main() {}
|
||||
| ^
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
Binary file not shown.
@ -10,29 +10,5 @@ LL | fn m(){print!("",(c for&g
|
||||
LL | e
|
||||
| ^
|
||||
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-88770.rs:8:3
|
||||
|
|
||||
LL | fn m(){print!("",(c for&g
|
||||
| - - - unclosed delimiter
|
||||
| | |
|
||||
| | unclosed delimiter
|
||||
| unclosed delimiter
|
||||
...
|
||||
LL | e
|
||||
| ^
|
||||
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-88770.rs:8:3
|
||||
|
|
||||
LL | fn m(){print!("",(c for&g
|
||||
| - - - unclosed delimiter
|
||||
| | |
|
||||
| | unclosed delimiter
|
||||
| unclosed delimiter
|
||||
...
|
||||
LL | e
|
||||
| ^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// ignore-tidy-trailing-newlines
|
||||
// error-pattern: this file contains an unclosed delimiter
|
||||
// error-pattern: aborting due to 2 previous errors
|
||||
// error-pattern: aborting due to previous error
|
||||
fn main((ؼ
|
@ -7,14 +7,5 @@ LL | fn main((ؼ
|
||||
| |unclosed delimiter
|
||||
| unclosed delimiter
|
||||
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/missing_right_paren.rs:4:11
|
||||
|
|
||||
LL | fn main((ؼ
|
||||
| -- ^
|
||||
| ||
|
||||
| |unclosed delimiter
|
||||
| unclosed delimiter
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -8,15 +8,5 @@ LL | 0: u8(ţ
|
||||
| |
|
||||
| unclosed delimiter
|
||||
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-91268.rs:5:12
|
||||
|
|
||||
LL | fn main() {
|
||||
| - unclosed delimiter
|
||||
LL | 0: u8(ţ
|
||||
| - ^
|
||||
| |
|
||||
| unclosed delimiter
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -1,23 +1,3 @@
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-91334.rs:7:23
|
||||
|
|
||||
LL | fn f(){||yield(((){),
|
||||
| - - - ^
|
||||
| | | |
|
||||
| | | missing open `(` for this delimiter
|
||||
| | unclosed delimiter
|
||||
| unclosed delimiter
|
||||
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-91334.rs:7:23
|
||||
|
|
||||
LL | fn f(){||yield(((){),
|
||||
| - - - ^
|
||||
| | | |
|
||||
| | | missing open `(` for this delimiter
|
||||
| | unclosed delimiter
|
||||
| unclosed delimiter
|
||||
|
||||
error: mismatched closing delimiter: `)`
|
||||
--> $DIR/issue-91334.rs:7:19
|
||||
|
|
||||
@ -27,5 +7,15 @@ LL | fn f(){||yield(((){),
|
||||
| | unclosed delimiter
|
||||
| closing delimiter possibly meant for this
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-91334.rs:7:23
|
||||
|
|
||||
LL | fn f(){||yield(((){),
|
||||
| - - - ^
|
||||
| | | |
|
||||
| | | missing open `(` for this delimiter
|
||||
| | unclosed delimiter
|
||||
| unclosed delimiter
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user