From bfdefdbfb740a2b41dbdf01299ecdf1610c54907 Mon Sep 17 00:00:00 2001 From: Bryan Garza <1396101+bryangarza@users.noreply.github.com> Date: Thu, 27 Oct 2022 22:55:50 +0000 Subject: [PATCH] Update tests based on feedback - Add comment to some tests that will break when #102745 is implemented - Mark a test with known-bug - Delete duplicate test --- .../in-trait/async-example-desugared-boxed.rs | 1 + .../async-example-desugared-in-trait.rs | 1 + .../in-trait/async-example-desugared.rs | 1 + .../async-await/in-trait/async-lifetimes.rs | 4 ++-- .../in-trait/async-lifetimes.stderr | 4 ++-- .../in-trait/fn-not-async-err2-rpitit.rs | 22 ------------------- 6 files changed, 7 insertions(+), 26 deletions(-) delete mode 100644 src/test/ui/async-await/in-trait/fn-not-async-err2-rpitit.rs diff --git a/src/test/ui/async-await/in-trait/async-example-desugared-boxed.rs b/src/test/ui/async-await/in-trait/async-example-desugared-boxed.rs index e1131753885b8..61d7e2520eab7 100644 --- a/src/test/ui/async-await/in-trait/async-example-desugared-boxed.rs +++ b/src/test/ui/async-await/in-trait/async-example-desugared-boxed.rs @@ -13,6 +13,7 @@ trait MyTrait { } impl MyTrait for i32 { + // This will break once a PR that implements #102745 is merged fn foo(&self) -> Pin + '_>> { Box::pin(async { *self diff --git a/src/test/ui/async-await/in-trait/async-example-desugared-in-trait.rs b/src/test/ui/async-await/in-trait/async-example-desugared-in-trait.rs index 6f61781709e73..feeda719e0306 100644 --- a/src/test/ui/async-await/in-trait/async-example-desugared-in-trait.rs +++ b/src/test/ui/async-await/in-trait/async-example-desugared-in-trait.rs @@ -12,6 +12,7 @@ trait MyTrait { } impl MyTrait for i32 { + // This will break once a PR that implements #102745 is merged async fn foo(&self) -> i32 { *self } diff --git a/src/test/ui/async-await/in-trait/async-example-desugared.rs b/src/test/ui/async-await/in-trait/async-example-desugared.rs index faf9a43d352d5..1313c9edd861c 100644 --- a/src/test/ui/async-await/in-trait/async-example-desugared.rs +++ b/src/test/ui/async-await/in-trait/async-example-desugared.rs @@ -12,6 +12,7 @@ trait MyTrait { } impl MyTrait for i32 { + // This will break once a PR that implements #102745 is merged fn foo(&self) -> impl Future + '_ { async { *self diff --git a/src/test/ui/async-await/in-trait/async-lifetimes.rs b/src/test/ui/async-await/in-trait/async-lifetimes.rs index 5dc1672da68fe..acbac471cf7e8 100644 --- a/src/test/ui/async-await/in-trait/async-lifetimes.rs +++ b/src/test/ui/async-await/in-trait/async-lifetimes.rs @@ -1,3 +1,5 @@ +// check-fail +// known-bug: #102682 // edition: 2021 #![feature(async_fn_in_trait)] @@ -5,8 +7,6 @@ trait MyTrait<'a, 'b, T> { async fn foo(&'a self, key: &'b T) -> (&'a Self, &'b T); - //~^ ERROR the parameter type `Self` may not live long enough - //~| ERROR the parameter type `T` may not live long enough } impl<'a, 'b, T, U> MyTrait<'a, 'b, T> for U { diff --git a/src/test/ui/async-await/in-trait/async-lifetimes.stderr b/src/test/ui/async-await/in-trait/async-lifetimes.stderr index 780f75cf683d4..9a7d294bb1766 100644 --- a/src/test/ui/async-await/in-trait/async-lifetimes.stderr +++ b/src/test/ui/async-await/in-trait/async-lifetimes.stderr @@ -1,5 +1,5 @@ error[E0309]: the parameter type `Self` may not live long enough - --> $DIR/async-lifetimes.rs:7:43 + --> $DIR/async-lifetimes.rs:9:43 | LL | async fn foo(&'a self, key: &'b T) -> (&'a Self, &'b T); | ^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | async fn foo(&'a self, key: &'b T) -> (&'a Self, &'b T); = note: ...so that the reference type `&'a Self` does not outlive the data it points at error[E0309]: the parameter type `T` may not live long enough - --> $DIR/async-lifetimes.rs:7:43 + --> $DIR/async-lifetimes.rs:9:43 | LL | async fn foo(&'a self, key: &'b T) -> (&'a Self, &'b T); | ^^^^^^^^^^^^^^^^^ ...so that the reference type `&'b T` does not outlive the data it points at diff --git a/src/test/ui/async-await/in-trait/fn-not-async-err2-rpitit.rs b/src/test/ui/async-await/in-trait/fn-not-async-err2-rpitit.rs deleted file mode 100644 index faf9a43d352d5..0000000000000 --- a/src/test/ui/async-await/in-trait/fn-not-async-err2-rpitit.rs +++ /dev/null @@ -1,22 +0,0 @@ -// check-pass -// edition: 2021 - -#![feature(async_fn_in_trait)] -#![feature(return_position_impl_trait_in_trait)] -#![allow(incomplete_features)] - -use std::future::Future; - -trait MyTrait { - async fn foo(&self) -> i32; -} - -impl MyTrait for i32 { - fn foo(&self) -> impl Future + '_ { - async { - *self - } - } -} - -fn main() {}