diff options
Diffstat (limited to 'tests/ui/polymorphization')
-rw-r--r-- | tests/ui/polymorphization/coroutine.rs (renamed from tests/ui/polymorphization/generators.rs) | 24 | ||||
-rw-r--r-- | tests/ui/polymorphization/coroutine.stderr (renamed from tests/ui/polymorphization/generators.stderr) | 12 |
2 files changed, 18 insertions, 18 deletions
diff --git a/tests/ui/polymorphization/generators.rs b/tests/ui/polymorphization/coroutine.rs index 779bac0ac..3f28e89e3 100644 --- a/tests/ui/polymorphization/generators.rs +++ b/tests/ui/polymorphization/coroutine.rs @@ -1,10 +1,10 @@ // build-fail // compile-flags:-Zpolymorphize=on -Zinline-mir=off -#![feature(generic_const_exprs, generators, generator_trait, rustc_attrs)] +#![feature(generic_const_exprs, coroutines, coroutine_trait, rustc_attrs)] //~^ WARN the feature `generic_const_exprs` is incomplete use std::marker::Unpin; -use std::ops::{Generator, GeneratorState}; +use std::ops::{Coroutine, CoroutineState}; use std::pin::Pin; enum YieldOrReturn<Y, R> { @@ -14,13 +14,13 @@ enum YieldOrReturn<Y, R> { fn finish<T, Y, R>(mut t: T) -> Vec<YieldOrReturn<Y, R>> where - T: Generator<(), Yield = Y, Return = R> + Unpin, + T: Coroutine<(), Yield = Y, Return = R> + Unpin, { let mut results = Vec::new(); loop { match Pin::new(&mut t).resume(()) { - GeneratorState::Yielded(yielded) => results.push(YieldOrReturn::Yield(yielded)), - GeneratorState::Complete(returned) => { + CoroutineState::Yielded(yielded) => results.push(YieldOrReturn::Yield(yielded)), + CoroutineState::Complete(returned) => { results.push(YieldOrReturn::Return(returned)); return results; } @@ -28,10 +28,10 @@ where } } -// This test checks that the polymorphization analysis functions on generators. +// This test checks that the polymorphization analysis functions on coroutines. #[rustc_polymorphize_error] -pub fn unused_type<T>() -> impl Generator<(), Yield = u32, Return = u32> + Unpin { +pub fn unused_type<T>() -> impl Coroutine<(), Yield = u32, Return = u32> + Unpin { || { //~^ ERROR item has unused generic parameters yield 1; @@ -40,7 +40,7 @@ pub fn unused_type<T>() -> impl Generator<(), Yield = u32, Return = u32> + Unpin } #[rustc_polymorphize_error] -pub fn used_type_in_yield<Y: Default>() -> impl Generator<(), Yield = Y, Return = u32> + Unpin { +pub fn used_type_in_yield<Y: Default>() -> impl Coroutine<(), Yield = Y, Return = u32> + Unpin { || { yield Y::default(); 2 @@ -48,7 +48,7 @@ pub fn used_type_in_yield<Y: Default>() -> impl Generator<(), Yield = Y, Return } #[rustc_polymorphize_error] -pub fn used_type_in_return<R: Default>() -> impl Generator<(), Yield = u32, Return = R> + Unpin { +pub fn used_type_in_return<R: Default>() -> impl Coroutine<(), Yield = u32, Return = R> + Unpin { || { yield 3; R::default() @@ -56,7 +56,7 @@ pub fn used_type_in_return<R: Default>() -> impl Generator<(), Yield = u32, Retu } #[rustc_polymorphize_error] -pub fn unused_const<const T: u32>() -> impl Generator<(), Yield = u32, Return = u32> + Unpin { +pub fn unused_const<const T: u32>() -> impl Coroutine<(), Yield = u32, Return = u32> + Unpin { || { //~^ ERROR item has unused generic parameters yield 1; @@ -65,7 +65,7 @@ pub fn unused_const<const T: u32>() -> impl Generator<(), Yield = u32, Return = } #[rustc_polymorphize_error] -pub fn used_const_in_yield<const Y: u32>() -> impl Generator<(), Yield = u32, Return = u32> + Unpin +pub fn used_const_in_yield<const Y: u32>() -> impl Coroutine<(), Yield = u32, Return = u32> + Unpin { || { yield Y; @@ -74,7 +74,7 @@ pub fn used_const_in_yield<const Y: u32>() -> impl Generator<(), Yield = u32, Re } #[rustc_polymorphize_error] -pub fn used_const_in_return<const R: u32>() -> impl Generator<(), Yield = u32, Return = u32> + Unpin +pub fn used_const_in_return<const R: u32>() -> impl Coroutine<(), Yield = u32, Return = u32> + Unpin { || { yield 4; diff --git a/tests/ui/polymorphization/generators.stderr b/tests/ui/polymorphization/coroutine.stderr index 32d49d25f..67b55a598 100644 --- a/tests/ui/polymorphization/generators.stderr +++ b/tests/ui/polymorphization/coroutine.stderr @@ -1,24 +1,24 @@ 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 + --> $DIR/coroutine.rs:3:12 | -LL | #![feature(generic_const_exprs, generators, generator_trait, rustc_attrs)] +LL | #![feature(generic_const_exprs, coroutines, coroutine_trait, rustc_attrs)] | ^^^^^^^^^^^^^^^^^^^ | = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information = note: `#[warn(incomplete_features)]` on by default error: item has unused generic parameters - --> $DIR/generators.rs:35:5 + --> $DIR/coroutine.rs:35:5 | -LL | pub fn unused_type<T>() -> impl Generator<(), Yield = u32, Return = u32> + Unpin { +LL | pub fn unused_type<T>() -> impl Coroutine<(), Yield = u32, Return = u32> + Unpin { | - generic parameter `T` is unused LL | || { | ^^ error: item has unused generic parameters - --> $DIR/generators.rs:60:5 + --> $DIR/coroutine.rs:60:5 | -LL | pub fn unused_const<const T: u32>() -> impl Generator<(), Yield = u32, Return = u32> + Unpin { +LL | pub fn unused_const<const T: u32>() -> impl Coroutine<(), Yield = u32, Return = u32> + Unpin { | ------------ generic parameter `T` is unused LL | || { | ^^ |