summaryrefslogtreecommitdiffstats
path: root/tests/ui/typeck/issue-112385-while-assign-lhs-place-expr-ice.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/typeck/issue-112385-while-assign-lhs-place-expr-ice.rs')
-rw-r--r--tests/ui/typeck/issue-112385-while-assign-lhs-place-expr-ice.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/ui/typeck/issue-112385-while-assign-lhs-place-expr-ice.rs b/tests/ui/typeck/issue-112385-while-assign-lhs-place-expr-ice.rs
new file mode 100644
index 000000000..3cb011dc0
--- /dev/null
+++ b/tests/ui/typeck/issue-112385-while-assign-lhs-place-expr-ice.rs
@@ -0,0 +1,9 @@
+// Previously, the while loop with an assignment statement (mistakenly) as the condition
+// which has a place expr as the LHS would trigger an ICE in typeck.
+// Reduced from https://github.com/rust-lang/rust/issues/112385.
+
+fn main() {
+ let foo = Some(());
+ while Some(foo) = None {}
+ //~^ ERROR mismatched types
+}