Skip to content

Commit 8a0ebca

Browse files
committed
Update static AFIT tests based on feedback
1 parent 97423d3 commit 8a0ebca

7 files changed

+28
-144
lines changed

src/test/ui/async-await/in-trait/async-associated-types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use std::fmt::Debug;
77

88
trait MyTrait<'a, 'b, T> where Self: 'a, T: Debug + Sized + 'b {
9-
type MyAssoc;// = (&'a T, &'b U);
9+
type MyAssoc;
1010

1111
async fn foo(&'a self, key: &'b T) -> Self::MyAssoc;
1212
}

src/test/ui/async-await/in-trait/async-associated-types2-desugared.rs

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/test/ui/async-await/in-trait/async-associated-types2-desugared.stderr

Lines changed: 0 additions & 42 deletions
This file was deleted.

src/test/ui/async-await/in-trait/async-associated-types2.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
// check-pass
12
// edition: 2021
23

34
#![feature(async_fn_in_trait)]
5+
#![feature(type_alias_impl_trait)]
46
#![allow(incomplete_features)]
57

68
use std::future::Future;
@@ -10,19 +12,15 @@ trait MyTrait {
1012
where
1113
Self: 'a;
1214

13-
fn foo(&self) -> Self::Fut<'a>;
14-
//~^ ERROR use of undeclared lifetime name `'a`
15+
fn foo<'a>(&'a self) -> Self::Fut<'a>;
1516
}
1617

1718
impl MyTrait for i32 {
18-
type Fut<'a> = impl Future + 'a
19+
type Fut<'a> = impl Future<Output = i32> + 'a
1920
where
2021
Self: 'a;
21-
//~^^^ ERROR `impl Trait` in type aliases is unstable
22-
//~| ERROR expected `<i32 as MyTrait>::Fut<'a>` to be a future that resolves to `i32`, but it resolves to `<<i32 as MyTrait>::Fut<'a> as Future>::Output`
2322

2423
fn foo<'a>(&'a self) -> Self::Fut<'a> {
25-
//~^ ERROR `impl` item signature doesn't match `trait` item signature
2624
async {
2725
*self
2826
}

src/test/ui/async-await/in-trait/async-associated-types2.stderr

Lines changed: 0 additions & 63 deletions
This file was deleted.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// check-pass
2+
// edition: 2021
3+
4+
#![feature(async_fn_in_trait)]
5+
#![feature(return_position_impl_trait_in_trait)]
6+
#![allow(incomplete_features)]
7+
8+
use std::future::Future;
9+
10+
trait MyTrait {
11+
async fn foo(&self) -> i32;
12+
}
13+
14+
impl MyTrait for i32 {
15+
fn foo(&self) -> impl Future<Output = i32> + '_ {
16+
async {
17+
*self
18+
}
19+
}
20+
}
21+
22+
fn main() {}

src/test/ui/async-await/in-trait/fn-not-async-err2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::future::Future;
88
trait MyTrait {
99
async fn foo(&self) -> i32;
1010
}
11-
11+
1212
impl MyTrait for i32 {
1313
fn foo(&self) -> impl Future<Output = i32> {
1414
//~^ ERROR `impl Trait` only allowed in function and inherent method return types, not in `impl` method return [E0562]

0 commit comments

Comments
 (0)