From af93c20c06ec1f577f0544aaf98403a5d9ff143c Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Fri, 20 Oct 2023 10:06:08 +0000 Subject: Rename lots of files that had `generator` in their name --- tests/ui/polymorphization/coroutine.rs | 92 +++++++++++++++++++++++++++++ tests/ui/polymorphization/coroutine.stderr | 27 +++++++++ tests/ui/polymorphization/generators.rs | 92 ----------------------------- tests/ui/polymorphization/generators.stderr | 27 --------- 4 files changed, 119 insertions(+), 119 deletions(-) create mode 100644 tests/ui/polymorphization/coroutine.rs create mode 100644 tests/ui/polymorphization/coroutine.stderr delete mode 100644 tests/ui/polymorphization/generators.rs delete mode 100644 tests/ui/polymorphization/generators.stderr (limited to 'tests/ui/polymorphization') diff --git a/tests/ui/polymorphization/coroutine.rs b/tests/ui/polymorphization/coroutine.rs new file mode 100644 index 00000000000..3f28e89e36c --- /dev/null +++ b/tests/ui/polymorphization/coroutine.rs @@ -0,0 +1,92 @@ +// build-fail +// compile-flags:-Zpolymorphize=on -Zinline-mir=off +#![feature(generic_const_exprs, coroutines, coroutine_trait, rustc_attrs)] +//~^ WARN the feature `generic_const_exprs` is incomplete + +use std::marker::Unpin; +use std::ops::{Coroutine, CoroutineState}; +use std::pin::Pin; + +enum YieldOrReturn { + Yield(Y), + Return(R), +} + +fn finish(mut t: T) -> Vec> +where + T: Coroutine<(), Yield = Y, Return = R> + Unpin, +{ + let mut results = Vec::new(); + loop { + match Pin::new(&mut t).resume(()) { + CoroutineState::Yielded(yielded) => results.push(YieldOrReturn::Yield(yielded)), + CoroutineState::Complete(returned) => { + results.push(YieldOrReturn::Return(returned)); + return results; + } + } + } +} + +// This test checks that the polymorphization analysis functions on coroutines. + +#[rustc_polymorphize_error] +pub fn unused_type() -> impl Coroutine<(), Yield = u32, Return = u32> + Unpin { + || { + //~^ ERROR item has unused generic parameters + yield 1; + 2 + } +} + +#[rustc_polymorphize_error] +pub fn used_type_in_yield() -> impl Coroutine<(), Yield = Y, Return = u32> + Unpin { + || { + yield Y::default(); + 2 + } +} + +#[rustc_polymorphize_error] +pub fn used_type_in_return() -> impl Coroutine<(), Yield = u32, Return = R> + Unpin { + || { + yield 3; + R::default() + } +} + +#[rustc_polymorphize_error] +pub fn unused_const() -> impl Coroutine<(), Yield = u32, Return = u32> + Unpin { + || { + //~^ ERROR item has unused generic parameters + yield 1; + 2 + } +} + +#[rustc_polymorphize_error] +pub fn used_const_in_yield() -> impl Coroutine<(), Yield = u32, Return = u32> + Unpin +{ + || { + yield Y; + 2 + } +} + +#[rustc_polymorphize_error] +pub fn used_const_in_return() -> impl Coroutine<(), Yield = u32, Return = u32> + Unpin +{ + || { + yield 4; + R + } +} + +fn main() { + finish(unused_type::()); + finish(used_type_in_yield::()); + finish(used_type_in_return::()); + finish(unused_const::<1u32>()); + finish(used_const_in_yield::<1u32>()); + finish(used_const_in_return::<1u32>()); +} diff --git a/tests/ui/polymorphization/coroutine.stderr b/tests/ui/polymorphization/coroutine.stderr new file mode 100644 index 00000000000..67b55a59883 --- /dev/null +++ b/tests/ui/polymorphization/coroutine.stderr @@ -0,0 +1,27 @@ +warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/coroutine.rs:3:12 + | +LL | #![feature(generic_const_exprs, coroutines, coroutine_trait, rustc_attrs)] + | ^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #76560 for more information + = note: `#[warn(incomplete_features)]` on by default + +error: item has unused generic parameters + --> $DIR/coroutine.rs:35:5 + | +LL | pub fn unused_type() -> impl Coroutine<(), Yield = u32, Return = u32> + Unpin { + | - generic parameter `T` is unused +LL | || { + | ^^ + +error: item has unused generic parameters + --> $DIR/coroutine.rs:60:5 + | +LL | pub fn unused_const() -> impl Coroutine<(), Yield = u32, Return = u32> + Unpin { + | ------------ generic parameter `T` is unused +LL | || { + | ^^ + +error: aborting due to 2 previous errors; 1 warning emitted + diff --git a/tests/ui/polymorphization/generators.rs b/tests/ui/polymorphization/generators.rs deleted file mode 100644 index 3f28e89e36c..00000000000 --- a/tests/ui/polymorphization/generators.rs +++ /dev/null @@ -1,92 +0,0 @@ -// build-fail -// compile-flags:-Zpolymorphize=on -Zinline-mir=off -#![feature(generic_const_exprs, coroutines, coroutine_trait, rustc_attrs)] -//~^ WARN the feature `generic_const_exprs` is incomplete - -use std::marker::Unpin; -use std::ops::{Coroutine, CoroutineState}; -use std::pin::Pin; - -enum YieldOrReturn { - Yield(Y), - Return(R), -} - -fn finish(mut t: T) -> Vec> -where - T: Coroutine<(), Yield = Y, Return = R> + Unpin, -{ - let mut results = Vec::new(); - loop { - match Pin::new(&mut t).resume(()) { - CoroutineState::Yielded(yielded) => results.push(YieldOrReturn::Yield(yielded)), - CoroutineState::Complete(returned) => { - results.push(YieldOrReturn::Return(returned)); - return results; - } - } - } -} - -// This test checks that the polymorphization analysis functions on coroutines. - -#[rustc_polymorphize_error] -pub fn unused_type() -> impl Coroutine<(), Yield = u32, Return = u32> + Unpin { - || { - //~^ ERROR item has unused generic parameters - yield 1; - 2 - } -} - -#[rustc_polymorphize_error] -pub fn used_type_in_yield() -> impl Coroutine<(), Yield = Y, Return = u32> + Unpin { - || { - yield Y::default(); - 2 - } -} - -#[rustc_polymorphize_error] -pub fn used_type_in_return() -> impl Coroutine<(), Yield = u32, Return = R> + Unpin { - || { - yield 3; - R::default() - } -} - -#[rustc_polymorphize_error] -pub fn unused_const() -> impl Coroutine<(), Yield = u32, Return = u32> + Unpin { - || { - //~^ ERROR item has unused generic parameters - yield 1; - 2 - } -} - -#[rustc_polymorphize_error] -pub fn used_const_in_yield() -> impl Coroutine<(), Yield = u32, Return = u32> + Unpin -{ - || { - yield Y; - 2 - } -} - -#[rustc_polymorphize_error] -pub fn used_const_in_return() -> impl Coroutine<(), Yield = u32, Return = u32> + Unpin -{ - || { - yield 4; - R - } -} - -fn main() { - finish(unused_type::()); - finish(used_type_in_yield::()); - finish(used_type_in_return::()); - finish(unused_const::<1u32>()); - finish(used_const_in_yield::<1u32>()); - finish(used_const_in_return::<1u32>()); -} diff --git a/tests/ui/polymorphization/generators.stderr b/tests/ui/polymorphization/generators.stderr deleted file mode 100644 index 41daba9c64f..00000000000 --- a/tests/ui/polymorphization/generators.stderr +++ /dev/null @@ -1,27 +0,0 @@ -warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/generators.rs:3:12 - | -LL | #![feature(generic_const_exprs, coroutines, coroutine_trait, rustc_attrs)] - | ^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #76560 for more information - = note: `#[warn(incomplete_features)]` on by default - -error: item has unused generic parameters - --> $DIR/generators.rs:35:5 - | -LL | pub fn unused_type() -> impl Coroutine<(), Yield = u32, Return = u32> + Unpin { - | - generic parameter `T` is unused -LL | || { - | ^^ - -error: item has unused generic parameters - --> $DIR/generators.rs:60:5 - | -LL | pub fn unused_const() -> impl Coroutine<(), Yield = u32, Return = u32> + Unpin { - | ------------ generic parameter `T` is unused -LL | || { - | ^^ - -error: aborting due to 2 previous errors; 1 warning emitted - -- cgit 1.4.1-3-g733a5