Skip to content

Commit

Permalink
Update tests based on feedback
Browse files Browse the repository at this point in the history
- Add comment to some tests that will break when #102745 is implemented
- Mark a test with known-bug
- Delete duplicate test
  • Loading branch information
bryangarza committed Oct 27, 2022
1 parent 0b3b046 commit bfdefdb
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/async-await/in-trait/async-lifetimes.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// check-fail
// known-bug: #102682
// edition: 2021

#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]

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 {
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/async-await/in-trait/async-lifetimes.stderr
Original file line number Diff line number Diff line change
@@ -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);
| ^^^^^^^^^^^^^^^^^
Expand All @@ -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
Expand Down
22 changes: 0 additions & 22 deletions src/test/ui/async-await/in-trait/fn-not-async-err2-rpitit.rs

This file was deleted.

0 comments on commit bfdefdb

Please sign in to comment.