about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-02-21 19:49:15 -0800
committerMichael Goulet <michael@errs.io>2022-02-27 19:27:50 -0800
commit025b7c433c109dad2c84f1cbeae422a3ffbd01b6 (patch)
treebf23d61d106259c1515fd543af2c8494df1d47a9 /src/test
parentd973b358c6dc5261f9c13e4ef7f9ab58586d628e (diff)
downloadrust-025b7c433c109dad2c84f1cbeae422a3ffbd01b6.tar.gz
rust-025b7c433c109dad2c84f1cbeae422a3ffbd01b6.zip
fix ICE when passing empty block to while-loop condition
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/typeck/while-loop-block-cond.rs4
-rw-r--r--src/test/ui/typeck/while-loop-block-cond.stderr9
2 files changed, 13 insertions, 0 deletions
diff --git a/src/test/ui/typeck/while-loop-block-cond.rs b/src/test/ui/typeck/while-loop-block-cond.rs
new file mode 100644
index 00000000000..929759766f2
--- /dev/null
+++ b/src/test/ui/typeck/while-loop-block-cond.rs
@@ -0,0 +1,4 @@
+fn main() {
+    while {} {}
+    //~^ ERROR mismatched types [E0308]
+}
diff --git a/src/test/ui/typeck/while-loop-block-cond.stderr b/src/test/ui/typeck/while-loop-block-cond.stderr
new file mode 100644
index 00000000000..598273af9cf
--- /dev/null
+++ b/src/test/ui/typeck/while-loop-block-cond.stderr
@@ -0,0 +1,9 @@
+error[E0308]: mismatched types
+  --> $DIR/while-loop-block-cond.rs:2:11
+   |
+LL |     while {} {}
+   |           ^^ expected `bool`, found `()`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.