summaryrefslogtreecommitdiffstats
path: root/tests/ui/for-loop-while
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
commitdc0db358abe19481e475e10c32149b53370f1a1c (patch)
treeab8ce99c4b255ce46f99ef402c27916055b899ee /tests/ui/for-loop-while
parentReleasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff)
downloadrustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz
rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/for-loop-while')
-rw-r--r--tests/ui/for-loop-while/issue-1257.rs11
-rw-r--r--tests/ui/for-loop-while/loop-break-value.rs10
2 files changed, 16 insertions, 5 deletions
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 ();
};