From dc0db358abe19481e475e10c32149b53370f1a1c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 05:57:31 +0200 Subject: Merging upstream version 1.72.1+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/for-loop-while/issue-1257.rs | 11 +++++++++++ tests/ui/for-loop-while/loop-break-value.rs | 10 +++++----- 2 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 tests/ui/for-loop-while/issue-1257.rs (limited to 'tests/ui/for-loop-while') diff --git a/tests/ui/for-loop-while/issue-1257.rs b/tests/ui/for-loop-while/issue-1257.rs new file mode 100644 index 000000000..de5a6d359 --- /dev/null +++ b/tests/ui/for-loop-while/issue-1257.rs @@ -0,0 +1,11 @@ +// run-pass +// pretty-expanded FIXME #23616 + +pub fn main () { + let mut line = "".to_string(); + let mut i = 0; + while line != "exit".to_string() { + line = if i == 9 { "exit".to_string() } else { "notexit".to_string() }; + i += 1; + } +} diff --git a/tests/ui/for-loop-while/loop-break-value.rs b/tests/ui/for-loop-while/loop-break-value.rs index d7209fc4d..65207fb7f 100644 --- a/tests/ui/for-loop-while/loop-break-value.rs +++ b/tests/ui/for-loop-while/loop-break-value.rs @@ -64,7 +64,7 @@ pub fn main() { }; assert_eq!(trait_unified_3, ["Yes"]); - let regular_break = loop { + let regular_break: () = loop { if true { break; } else { @@ -73,7 +73,7 @@ pub fn main() { }; assert_eq!(regular_break, ()); - let regular_break_2 = loop { + let regular_break_2: () = loop { if true { break Default::default(); } else { @@ -82,7 +82,7 @@ pub fn main() { }; assert_eq!(regular_break_2, ()); - let regular_break_3 = loop { + let regular_break_3: () = loop { break if true { Default::default() } else { @@ -91,13 +91,13 @@ pub fn main() { }; assert_eq!(regular_break_3, ()); - let regular_break_4 = loop { + let regular_break_4: () = loop { break (); break; }; assert_eq!(regular_break_4, ()); - let regular_break_5 = loop { + let regular_break_5: () = loop { break; break (); }; -- cgit v1.2.3