forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
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#114668 - compiler-errors:match-fn-def, r=pe…
…trochenkov Deny `FnDef` in patterns We can only see these via `const { .. }` patterns, which are unstable. cc rust-lang#76001 (tracking issue for inline const pats) Fixes rust-lang#114658 Fixes rust-lang#114659
- Loading branch information
Showing
3 changed files
with
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#![feature(inline_const_pat)] | ||
//~^ WARN the feature `inline_const_pat` is incomplete | ||
|
||
fn uwu() {} | ||
|
||
fn main() { | ||
let x = []; | ||
match x[123] { | ||
const { uwu } => {} | ||
//~^ ERROR `fn() {uwu}` 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,17 @@ | ||
warning: the feature `inline_const_pat` is incomplete and may not be safe to use and/or cause compiler crashes | ||
--> $DIR/pat-match-fndef.rs:1:12 | ||
| | ||
LL | #![feature(inline_const_pat)] | ||
| ^^^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #76001 <https://github.com/rust-lang/rust/issues/76001> for more information | ||
= note: `#[warn(incomplete_features)]` on by default | ||
|
||
error: `fn() {uwu}` cannot be used in patterns | ||
--> $DIR/pat-match-fndef.rs:9:9 | ||
| | ||
LL | const { uwu } => {} | ||
| ^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error; 1 warning emitted | ||
|