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
This commit is contained in:
Bryan Garza 2022-10-27 22:55:50 +00:00
parent 0b3b046436
commit bfdefdbfb7
6 changed files with 7 additions and 26 deletions

View File

@ -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<dyn Future<Output = i32> + '_>> {
Box::pin(async {
*self

View File

@ -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
}

View File

@ -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<Output = i32> + '_ {
async {
*self

View File

@ -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 {

View File

@ -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

View File

@ -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<Output = i32> + '_ {
async {
*self
}
}
}
fn main() {}