Rollup merge of #143589 - RalfJung:const-pat, r=compiler-errors

const-block-as-pattern: do not refer to no-longer-existing nightly feature

Surely everyone who used this nightly feature has fixed their code by now. So let's not confused people on stable that try to use a const block as a pattern by referring to some dead nightly feature.
This commit is contained in:
Matthias Krüger
2025-07-08 03:09:58 +02:00
committed by GitHub
3 changed files with 7 additions and 5 deletions

View File

@@ -1293,8 +1293,10 @@ impl<'a> Parser<'a> {
let kind = if pat {
let guar = self
.dcx()
.struct_span_err(blk_span, "`inline_const_pat` has been removed")
.with_help("use a named `const`-item or an `if`-guard instead")
.struct_span_err(blk_span, "const blocks cannot be used as patterns")
.with_help(
"use a named `const`-item or an `if`-guard (`x if x == const { ... }`) instead",
)
.emit();
ExprKind::Err(guar)
} else {