From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/loops/loop-break-value-no-repeat.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/ui/loops/loop-break-value-no-repeat.rs (limited to 'tests/ui/loops/loop-break-value-no-repeat.rs') diff --git a/tests/ui/loops/loop-break-value-no-repeat.rs b/tests/ui/loops/loop-break-value-no-repeat.rs new file mode 100644 index 000000000..1c0b7a018 --- /dev/null +++ b/tests/ui/loops/loop-break-value-no-repeat.rs @@ -0,0 +1,14 @@ +#![allow(unused_variables)] + +use std::ptr; + +// Test that we only report **one** error here and that is that +// `break` with an expression is illegal in this context. In +// particular, we don't report any mismatched types error, which is +// besides the point. + +fn main() { + for _ in &[1,2,3] { + break 22 //~ ERROR `break` with value from a `for` loop + } +} -- cgit v1.2.3