From d14be60b5d6a3b6470e553561ca7c269201e93b7 Mon Sep 17 00:00:00 2001 From: Jacob Adam Date: Sun, 12 Apr 2026 23:22:43 +0100 Subject: [PATCH] Convert the regression test for a coroutine ICE from a crash test to an UI test --- tests/crashes/139570.rs | 4 ---- tests/ui/coroutine/too-many-parameters-ice.rs | 13 +++++++++++++ .../coroutine/too-many-parameters-ice.stderr | 18 ++++++++++++++++++ 3 files changed, 31 insertions(+), 4 deletions(-) delete mode 100644 tests/crashes/139570.rs create mode 100644 tests/ui/coroutine/too-many-parameters-ice.rs create mode 100644 tests/ui/coroutine/too-many-parameters-ice.stderr diff --git a/tests/crashes/139570.rs b/tests/crashes/139570.rs deleted file mode 100644 index 9c001aaf848a..000000000000 --- a/tests/crashes/139570.rs +++ /dev/null @@ -1,4 +0,0 @@ -//@ known-bug: #139570 -fn main() { - |(1, 42), ()| yield; -} diff --git a/tests/ui/coroutine/too-many-parameters-ice.rs b/tests/ui/coroutine/too-many-parameters-ice.rs new file mode 100644 index 000000000000..350839312047 --- /dev/null +++ b/tests/ui/coroutine/too-many-parameters-ice.rs @@ -0,0 +1,13 @@ +//! Regression test for . +//! A coroutine with too many parameters should emit errors without an ICE. + +#![feature(coroutines)] + +fn main() { + #[coroutine] + |(1, 42), ()| { + //~^ ERROR too many parameters for a coroutine + //~| ERROR refutable pattern in closure argument + yield + }; +} diff --git a/tests/ui/coroutine/too-many-parameters-ice.stderr b/tests/ui/coroutine/too-many-parameters-ice.stderr new file mode 100644 index 000000000000..93d995b1888c --- /dev/null +++ b/tests/ui/coroutine/too-many-parameters-ice.stderr @@ -0,0 +1,18 @@ +error[E0628]: too many parameters for a coroutine (expected 0 or 1 parameters) + --> $DIR/too-many-parameters-ice.rs:8:5 + | +LL | |(1, 42), ()| { + | ^^^^^^^^^^^^^ + +error[E0005]: refutable pattern in closure argument + --> $DIR/too-many-parameters-ice.rs:8:6 + | +LL | |(1, 42), ()| { + | ^^^^^^^ patterns `(i32::MIN..=0_i32, _)` and `(2_i32..=i32::MAX, _)` not covered + | + = note: the matched value is of type `(i32, i32)` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0005, E0628. +For more information about an error, try `rustc --explain E0005`.