diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 18:31:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 18:31:44 +0000 |
commit | c23a457e72abe608715ac76f076f47dc42af07a5 (patch) | |
tree | 2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /tests/ui/loops/loop-break-value.rs | |
parent | Releasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip |
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | tests/ui/loops/loop-break-value.rs | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/tests/ui/loops/loop-break-value.rs b/tests/ui/loops/loop-break-value.rs index 51c9a36a0..c35200520 100644 --- a/tests/ui/loops/loop-break-value.rs +++ b/tests/ui/loops/loop-break-value.rs @@ -95,4 +95,67 @@ fn main() { break LOOP; //~^ ERROR cannot find value `LOOP` in this scope } + + let _ = 'a: loop { + loop { + break; // This doesn't affect the expected break type of the 'a loop + loop { + loop { + break 'a 1; + } + } + } + break; //~ ERROR mismatched types + }; + + let _ = 'a: loop { + loop { + break; // This doesn't affect the expected break type of the 'a loop + loop { + loop { + break 'a 1; + } + } + } + break 'a; //~ ERROR mismatched types + }; + + loop { + break; + let _ = loop { + break 2; + loop { + break; + } + }; + break 2; //~ ERROR mismatched types + } + + 'a: loop { + break; + let _ = 'a: loop { + //~^ WARNING label name `'a` shadows a label name that is already in scope + break 2; + loop { + break 'a; //~ ERROR mismatched types + } + }; + break 2; //~ ERROR mismatched types + } + + 'a: loop { + break; + let _ = 'a: loop { + //~^ WARNING label name `'a` shadows a label name that is already in scope + break 'a 2; + loop { + break 'a; //~ ERROR mismatched types + } + }; + break 2; //~ ERROR mismatched types + }; + + loop { // point at the return type + break 2; //~ ERROR mismatched types + } } |