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> {
12931293 let kind = if pat {
12941294 let guar = self
12951295 . 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+ )
12981300 . emit ( ) ;
12991301 ExprKind :: Err ( guar)
13001302 } else {
Original file line number Diff line number Diff line change 44fn main ( ) {
55 match 1 {
66 const { 1 + 7 } => { }
7- //~^ ERROR `inline_const_pat` has been removed
7+ //~^ ERROR const blocks cannot be used as patterns
88 2 => { }
99 _ => { }
1010 }
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
22 --> $DIR/in-pat-recovery.rs:6:15
33 |
44LL | const { 1 + 7 } => {}
55 | ^^^^^^^^^
66 |
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
88
99error: aborting due to 1 previous error
1010
You can’t perform that action at this time.
0 commit comments