-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TokenTreesReader now can find the correct mismatch delimiter pairs
- Loading branch information
1 parent
6718ea1
commit 1a8e69a
Showing
13 changed files
with
231 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// ignore-tidy-trailing-newlines | ||
// | ||
// error-pattern: this file contains an unclosed delimiter | ||
#![feature(let_chains)] | ||
trait Demo {} | ||
|
||
impl dyn Demo { | ||
pub fn report(&self) -> u32 { | ||
let sum = |a: u32, | ||
b: u32, | ||
c: u32| { | ||
a + b + c | ||
}; | ||
sum(1, 2, 3) | ||
} | ||
|
||
fn check(&self, val: Option<u32>, num: Option<u32>) { | ||
if let Some(b) = val | ||
&& let Some(c) = num { | ||
&& b == c { | ||
//~^ ERROR expected struct | ||
//~| ERROR mismatched types | ||
} | ||
} | ||
} | ||
|
||
fn main() { } //~ ERROR this file contains an unclosed delimiter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
error: this file contains an unclosed delimiter | ||
--> $DIR/deli-ident-issue-1.rs:27:65 | ||
| | ||
LL | impl dyn Demo { | ||
| - unclosed delimiter | ||
... | ||
LL | && let Some(c) = num { | ||
| - this delimiter might not be properly closed... | ||
... | ||
LL | } | ||
| - ...as it matches this but it has different indentation | ||
... | ||
LL | fn main() { } | ||
| ^ | ||
|
||
error[E0574]: expected struct, variant or union type, found local variable `c` | ||
--> $DIR/deli-ident-issue-1.rs:20:17 | ||
| | ||
LL | && b == c { | ||
| ^ not a struct, variant or union type | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/deli-ident-issue-1.rs:20:9 | ||
| | ||
LL | fn check(&self, val: Option<u32>, num: Option<u32>) { | ||
| - expected `()` because of default return type | ||
... | ||
LL | / && b == c { | ||
LL | | | ||
LL | | | ||
LL | | } | ||
| |_________^ expected `()`, found `bool` | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
Some errors have detailed explanations: E0308, E0574. | ||
For more information about an error, try `rustc --explain E0308`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// ignore-tidy-trailing-newlines | ||
// | ||
// error-pattern: this file contains an unclosed delimiter | ||
#![feature(let_chains)] | ||
trait Demo {} | ||
|
||
impl dyn Demo { | ||
pub fn report(&self, | ||
a: u32, | ||
b: u32, | ||
c: u32) -> u32 { | ||
return a + b + c; | ||
} | ||
|
||
fn check(&self, val: Option<u32>, num: Option<u32>) { | ||
if let Some(b) = val | ||
&& let Some(c) = num { | ||
&& b == c { | ||
//~^ ERROR expected struct | ||
//~| ERROR mismatched types | ||
} | ||
} | ||
} | ||
|
||
fn main() { } //~ ERROR this file contains an unclosed delimiter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
error: this file contains an unclosed delimiter | ||
--> $DIR/deli-ident-issue-2.rs:25:65 | ||
| | ||
LL | impl dyn Demo { | ||
| - unclosed delimiter | ||
... | ||
LL | && let Some(c) = num { | ||
| - this delimiter might not be properly closed... | ||
... | ||
LL | } | ||
| - ...as it matches this but it has different indentation | ||
... | ||
LL | fn main() { } | ||
| ^ | ||
|
||
error[E0574]: expected struct, variant or union type, found local variable `c` | ||
--> $DIR/deli-ident-issue-2.rs:18:17 | ||
| | ||
LL | && b == c { | ||
| ^ not a struct, variant or union type | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/deli-ident-issue-2.rs:18:9 | ||
| | ||
LL | fn check(&self, val: Option<u32>, num: Option<u32>) { | ||
| - expected `()` because of default return type | ||
... | ||
LL | / && b == c { | ||
LL | | | ||
LL | | | ||
LL | | } | ||
| |_________^ expected `()`, found `bool` | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
Some errors have detailed explanations: E0308, E0574. | ||
For more information about an error, try `rustc --explain E0308`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// This file has unexpected closing delimiter, | ||
|
||
fn func(o: Option<u32>) { | ||
match o { | ||
Some(_x) => | ||
let _ = if true {}; | ||
} | ||
None => {} | ||
} | ||
} //~ ERROR unexpected closing delimiter | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
error: unexpected closing delimiter: `}` | ||
--> $DIR/issue-68987-unmatch-issue.rs:10:1 | ||
| | ||
LL | match o { | ||
| - this delimiter might not be properly closed... | ||
... | ||
LL | } | ||
| - ...as it matches this but it has different indentation | ||
... | ||
LL | } | ||
| ^ unexpected closing delimiter | ||
|
||
error: aborting due to previous error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters