about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-12-22 01:01:12 +0100
committerGitHub <noreply@github.com>2022-12-22 01:01:12 +0100
commit3eccc297d42b09eaecbf05a6846f1d5c9abc0b95 (patch)
tree3793cc858cc709090d5ae3b775bb65753316e95b /src/test
parentb569c9dc57ee22b6ff94563af856909763dfa24b (diff)
parent4042f550795c042aee3087b0e0dcb7083e7a9e00 (diff)
downloadrust-3eccc297d42b09eaecbf05a6846f1d5c9abc0b95.tar.gz
rust-3eccc297d42b09eaecbf05a6846f1d5c9abc0b95.zip
Rollup merge of #105837 - compiler-errors:issue-105728, r=estebank
Don't ICE in `check_must_not_suspend_ty` for mismatched tuple arity

These expressions are just used for their spans, so make it best-effort here.

Fixes #105728
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/lint/must_not_suspend/tuple-mismatch.rs9
-rw-r--r--src/test/ui/lint/must_not_suspend/tuple-mismatch.stderr12
2 files changed, 21 insertions, 0 deletions
diff --git a/src/test/ui/lint/must_not_suspend/tuple-mismatch.rs b/src/test/ui/lint/must_not_suspend/tuple-mismatch.rs
new file mode 100644
index 00000000000..c7e14e42561
--- /dev/null
+++ b/src/test/ui/lint/must_not_suspend/tuple-mismatch.rs
@@ -0,0 +1,9 @@
+#![feature(generators)]
+
+fn main() {
+    let _generator = || {
+        yield ((), ((), ()));
+        yield ((), ());
+        //~^ ERROR mismatched types
+    };
+}
diff --git a/src/test/ui/lint/must_not_suspend/tuple-mismatch.stderr b/src/test/ui/lint/must_not_suspend/tuple-mismatch.stderr
new file mode 100644
index 00000000000..cca8cd9bd89
--- /dev/null
+++ b/src/test/ui/lint/must_not_suspend/tuple-mismatch.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+  --> $DIR/tuple-mismatch.rs:6:20
+   |
+LL |         yield ((), ());
+   |                    ^^ expected tuple, found `()`
+   |
+   = note:  expected tuple `((), ())`
+           found unit type `()`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.