From 7d0caef85393f77913b692d8832a3c79d00154cc Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Tue, 1 Jul 2025 16:54:36 +0200 Subject: [PATCH] loop match: error on `#[const_continue]` outside `#[loop_match]` --- compiler/rustc_hir/src/hir.rs | 2 +- compiler/rustc_hir_typeck/src/loops.rs | 34 +++++++++++-------- .../const-continue-outside-loop-match.rs | 13 +++++++ .../const-continue-outside-loop-match.stderr | 8 +++++ .../ui/loop-match/const-continue-to-block.rs | 21 ++++++++++++ .../loop-match/const-continue-to-block.stderr | 17 +++++++++- tests/ui/loop-match/invalid.rs | 19 +++++++++++ tests/ui/loop-match/invalid.stderr | 22 +++++++++--- 8 files changed, 115 insertions(+), 21 deletions(-) create mode 100644 tests/ui/loop-match/const-continue-outside-loop-match.rs create mode 100644 tests/ui/loop-match/const-continue-outside-loop-match.stderr diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index c90cd93ff0782..c8e55a0b329bf 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -2992,7 +2992,7 @@ impl fmt::Display for LoopIdError { } } -#[derive(Copy, Clone, Debug, HashStable_Generic)] +#[derive(Copy, Clone, Debug, PartialEq, HashStable_Generic)] pub struct Destination { /// This is `Some(_)` iff there is an explicit user-specified 'label pub label: Option