loop match: error on #[const_continue] outside #[loop_match]
This commit is contained in:
@@ -87,7 +87,7 @@ mir_build_confused = missing patterns are not covered because `{$variable}` is i
|
||||
mir_build_const_continue_bad_const = could not determine the target branch for this `#[const_continue]`
|
||||
.label = this value is too generic
|
||||
|
||||
mir_build_const_continue_missing_value = a `#[const_continue]` must break to a label with a value
|
||||
mir_build_const_continue_missing_label_or_value = a `#[const_continue]` must break to a label with a value
|
||||
|
||||
mir_build_const_continue_not_const = could not determine the target branch for this `#[const_continue]`
|
||||
.help = try extracting the expression into a `const` item
|
||||
|
||||
@@ -1254,8 +1254,8 @@ pub(crate) struct ConstContinueBadConst {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(mir_build_const_continue_missing_value)]
|
||||
pub(crate) struct ConstContinueMissingValue {
|
||||
#[diag(mir_build_const_continue_missing_label_or_value)]
|
||||
pub(crate) struct ConstContinueMissingLabelOrValue {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
@@ -852,9 +852,9 @@ impl<'tcx> ThirBuildCx<'tcx> {
|
||||
if find_attr!(self.tcx.hir_attrs(expr.hir_id), AttributeKind::ConstContinue(_)) {
|
||||
match dest.target_id {
|
||||
Ok(target_id) => {
|
||||
let Some(value) = value else {
|
||||
let (Some(value), Some(_)) = (value, dest.label) else {
|
||||
let span = expr.span;
|
||||
self.tcx.dcx().emit_fatal(ConstContinueMissingValue { span })
|
||||
self.tcx.dcx().emit_fatal(ConstContinueMissingLabelOrValue { span })
|
||||
};
|
||||
|
||||
ExprKind::ConstContinue {
|
||||
|
||||
Reference in New Issue
Block a user