-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only use indentation to detect mismatch delimiter when the line start…
…ing with delimiter
- Loading branch information
1 parent
6718ea1
commit 83c0934
Showing
8 changed files
with
119 additions
and
16 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,31 @@ | ||
error: this file contains an unclosed delimiter | ||
--> $DIR/deli-ident-issue-1.rs:27:65 | ||
| | ||
LL | impl dyn Demo { | ||
| - unclosed delimiter | ||
... | ||
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,31 @@ | ||
error: this file contains an unclosed delimiter | ||
--> $DIR/deli-ident-issue-2.rs:25:65 | ||
| | ||
LL | impl dyn Demo { | ||
| - unclosed delimiter | ||
... | ||
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
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