Skip to content

Commit 01babdc

Browse files
committed
add more testcase for issue 68987
1 parent 0868f18 commit 01babdc

File tree

5 files changed

+57
-1
lines changed

5 files changed

+57
-1
lines changed

compiler/rustc_parse/src/lexer/tokentrees.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ impl<'a> TokenTreesReader<'a> {
279279
"...as it matches this but it has different indentation",
280280
);
281281

282-
// If there is a empty block in the mismatched span, note it
282+
// If there is a empty block in the mismatched span, note it
283283
for span in self.empty_block_spans.keys() {
284284
if let Some(d) = self.empty_block_spans.get(span) &&
285285
*d == delim && block_span.contains(*span) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
async fn obstest() -> Result<> {
2+
let obs_connect = || -> Result<(), MyError) { //~ ERROR mismatched closing delimiter
3+
async {
4+
}
5+
}
6+
7+
if let Ok(version, scene_list) = obs_connect() {
8+
9+
} else {
10+
11+
}
12+
} //~ ERROR unexpected closing delimiter
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error: unexpected closing delimiter: `}`
2+
--> $DIR/issue-68987-unmatch-issue-2.rs:12:1
3+
|
4+
LL | }
5+
| ^ unexpected closing delimiter
6+
7+
error: mismatched closing delimiter: `)`
8+
--> $DIR/issue-68987-unmatch-issue-2.rs:1:32
9+
|
10+
LL | async fn obstest() -> Result<> {
11+
| ^ unclosed delimiter
12+
LL | let obs_connect = || -> Result<(), MyError) {
13+
| ^ mismatched closing delimiter
14+
15+
error: aborting due to 2 previous errors
16+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
fn f(i: u32, j: u32) {
2+
let res = String::new();
3+
let mut cnt = i;
4+
while cnt < j {
5+
write!&mut res, " "); //~ ERROR mismatched closing delimiter
6+
}
7+
} //~ ERROR unexpected closing delimiter
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
error: unexpected closing delimiter: `}`
2+
--> $DIR/issue-68987-unmatch-issue-3.rs:7:1
3+
|
4+
LL | fn f(i: u32, j: u32) {
5+
| - this delimiter might not be properly closed...
6+
...
7+
LL | }
8+
| - ...as it matches this but it has different indentation
9+
LL | }
10+
| ^ unexpected closing delimiter
11+
12+
error: mismatched closing delimiter: `)`
13+
--> $DIR/issue-68987-unmatch-issue-3.rs:4:19
14+
|
15+
LL | while cnt < j {
16+
| ^ unclosed delimiter
17+
LL | write!&mut res, " ");
18+
| ^ mismatched closing delimiter
19+
20+
error: aborting due to 2 previous errors
21+

0 commit comments

Comments
 (0)