forked from rust-lang/rust
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#90028 - tmiasko:structural-match-closure, r…
…=spastorino Reject closures in patterns Fixes rust-lang#90013.
- Loading branch information
Showing
5 changed files
with
44 additions
and
1 deletion.
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
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,8 @@ | ||
// Regression test for issue 90013. | ||
// check-pass | ||
#![allow(incomplete_features)] | ||
#![feature(inline_const)] | ||
|
||
fn main() { | ||
const { || {} }; | ||
} |
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 @@ | ||
// edition:2021 | ||
#![allow(incomplete_features)] | ||
#![allow(unreachable_code)] | ||
#![feature(const_async_blocks)] | ||
#![feature(inline_const)] | ||
|
||
fn main() { | ||
match loop {} { | ||
const { || {} } => {}, //~ ERROR cannot be used in patterns | ||
} | ||
match loop {} { | ||
const { async {} } => {}, //~ ERROR cannot be used in patterns | ||
} | ||
} |
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: `[closure@$DIR/non-structural-match-types.rs:9:17: 9:22]` cannot be used in patterns | ||
--> $DIR/non-structural-match-types.rs:9:9 | ||
| | ||
LL | const { || {} } => {}, | ||
| ^^^^^^^^^^^^^^^ | ||
|
||
error: `impl Future` cannot be used in patterns | ||
--> $DIR/non-structural-match-types.rs:12:9 | ||
| | ||
LL | const { async {} } => {}, | ||
| ^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 2 previous errors | ||
|