diff options
| author | bors <bors@rust-lang.org> | 2023-10-13 19:26:27 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-10-13 19:26:27 +0000 |
| commit | 09eff4488902242b8a4a86697d74ad4166ee9e7e (patch) | |
| tree | 7cee3e90ec8ae7716fee38021dbc35c12c91c341 /tests/ui/parser | |
| parent | 57ef8898520f7ff2c60341636bb86d94cb550e79 (diff) | |
| parent | 6b2c6c7fd3860cc9e6fde3077b889abbd6a30892 (diff) | |
| download | rust-09eff4488902242b8a4a86697d74ad4166ee9e7e.tar.gz rust-09eff4488902242b8a4a86697d74ad4166ee9e7e.zip | |
Auto merge of #116645 - estebank:issue-116608, r=oli-obk
Detect ruby-style closure in parser When parsing a closure without a body that is surrounded by a block, suggest moving the opening brace after the closure head. Fix #116608.
Diffstat (limited to 'tests/ui/parser')
| -rw-r--r-- | tests/ui/parser/issues/issue-32505.rs | 1 | ||||
| -rw-r--r-- | tests/ui/parser/issues/issue-32505.stderr | 18 |
2 files changed, 17 insertions, 2 deletions
diff --git a/tests/ui/parser/issues/issue-32505.rs b/tests/ui/parser/issues/issue-32505.rs index f31c00e5cc3..d95e7dc7d9e 100644 --- a/tests/ui/parser/issues/issue-32505.rs +++ b/tests/ui/parser/issues/issue-32505.rs @@ -1,5 +1,6 @@ pub fn test() { foo(|_|) //~ ERROR expected expression, found `)` + //~^ ERROR cannot find function `foo` in this scope } fn main() { } diff --git a/tests/ui/parser/issues/issue-32505.stderr b/tests/ui/parser/issues/issue-32505.stderr index cdd779a93ef..27ad2c3e5be 100644 --- a/tests/ui/parser/issues/issue-32505.stderr +++ b/tests/ui/parser/issues/issue-32505.stderr @@ -2,7 +2,21 @@ error: expected expression, found `)` --> $DIR/issue-32505.rs:2:12 | LL | foo(|_|) - | ^ expected expression + | ---^ expected expression + | | + | while parsing the body of this closure + | +help: you might have meant to open the body of the closure + | +LL | foo(|_| {}) + | ++ + +error[E0425]: cannot find function `foo` in this scope + --> $DIR/issue-32505.rs:2:5 + | +LL | foo(|_|) + | ^^^ not found in this scope -error: aborting due to previous error +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0425`. |
