File tree Expand file tree Collapse file tree 3 files changed +7
-5
lines changed
compiler/rustc_parse/src/parser Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -1293,8 +1293,10 @@ impl<'a> Parser<'a> {
1293
1293
let kind = if pat {
1294
1294
let guar = self
1295
1295
. dcx ( )
1296
- . struct_span_err ( blk_span, "`inline_const_pat` has been removed" )
1297
- . with_help ( "use a named `const`-item or an `if`-guard instead" )
1296
+ . struct_span_err ( blk_span, "const blocks cannot be used as patterns" )
1297
+ . with_help (
1298
+ "use a named `const`-item or an `if`-guard (`x if x == const { ... }`) instead" ,
1299
+ )
1298
1300
. emit ( ) ;
1299
1301
ExprKind :: Err ( guar)
1300
1302
} else {
Original file line number Diff line number Diff line change 4
4
fn main ( ) {
5
5
match 1 {
6
6
const { 1 + 7 } => { }
7
- //~^ ERROR `inline_const_pat` has been removed
7
+ //~^ ERROR const blocks cannot be used as patterns
8
8
2 => { }
9
9
_ => { }
10
10
}
Original file line number Diff line number Diff line change 1
- error: `inline_const_pat` has been removed
1
+ error: const blocks cannot be used as patterns
2
2
--> $DIR/in-pat-recovery.rs:6:15
3
3
|
4
4
LL | const { 1 + 7 } => {}
5
5
| ^^^^^^^^^
6
6
|
7
- = help: use a named `const`-item or an `if`-guard instead
7
+ = help: use a named `const`-item or an `if`-guard (`x if x == const { ... }`) instead
8
8
9
9
error: aborting due to 1 previous error
10
10
You can’t perform that action at this time.
0 commit comments