Bless tests · rust-lang/rust@28d58f6 (original) (raw)
26 files changed
lines changed
Original file line number |
Diff line number |
Diff line change |
@@ -9,12 +9,14 @@ use std::fmt::Debug; |
|
|
9 |
9 |
trait MyTrait<'a, 'b, T> where Self: 'a, T: Debug + Sized + 'b { |
10 |
10 |
type MyAssoc; |
11 |
11 |
|
|
12 |
+#[allow(async_fn_in_trait)] |
12 |
13 |
async fn foo(&'a self, key: &'b T) -> Self::MyAssoc; |
13 |
14 |
} |
14 |
15 |
|
15 |
16 |
impl<'a, 'b, T: Debug + Sized + 'b, U: 'a> MyTrait<'a, 'b, T> for U { |
16 |
17 |
type MyAssoc = (&'a U, &'b T); |
17 |
18 |
|
|
19 |
+#[allow(async_fn_in_trait)] |
18 |
20 |
async fn foo(&'a self, key: &'b T) -> (&'a U, &'b T) { |
19 |
21 |
(self, key) |
20 |
22 |
} |
Original file line number |
Diff line number |
Diff line change |
@@ -6,10 +6,12 @@ |
|
|
6 |
6 |
use std::future::Future; |
7 |
7 |
|
8 |
8 |
trait AsyncTrait { |
|
9 |
+#[allow(async_fn_in_trait)] |
9 |
10 |
async fn default_impl() { |
10 |
11 |
assert!(false); |
11 |
12 |
} |
12 |
13 |
|
|
14 |
+#[allow(async_fn_in_trait)] |
13 |
15 |
async fn call_default_impl() { |
14 |
16 |
Self::default_impl().await |
15 |
17 |
} |
Original file line number |
Diff line number |
Diff line change |
@@ -10,6 +10,7 @@ use std::pin::Pin; |
|
|
10 |
10 |
use std::task::Poll; |
11 |
11 |
|
12 |
12 |
pub trait MyTrait { |
|
13 |
+#[allow(async_fn_in_trait)] |
13 |
14 |
async fn foo(&self) -> i32; |
14 |
15 |
} |
15 |
16 |
|
Original file line number |
Diff line number |
Diff line change |
@@ -8,6 +8,7 @@ |
|
|
8 |
8 |
use std::future::Future; |
9 |
9 |
|
10 |
10 |
trait MyTrait { |
|
11 |
+#[allow(async_fn_in_trait)] |
11 |
12 |
async fn foo(&self) -> i32; |
12 |
13 |
} |
13 |
14 |
|
Original file line number |
Diff line number |
Diff line change |
@@ -5,7 +5,10 @@ |
|
|
5 |
5 |
#![allow(incomplete_features)] |
6 |
6 |
|
7 |
7 |
trait MyTrait { |
|
8 |
+#[allow(async_fn_in_trait)] |
8 |
9 |
async fn foo(&self) -> i32; |
|
10 |
+ |
|
11 |
+#[allow(async_fn_in_trait)] |
9 |
12 |
async fn bar(&self) -> i32; |
10 |
13 |
} |
11 |
14 |
|
Original file line number |
Diff line number |
Diff line change |
@@ -7,6 +7,7 @@ |
|
|
7 |
7 |
use std::fmt::Debug; |
8 |
8 |
|
9 |
9 |
trait MyTrait<'a, 'b, T> { |
|
10 |
+#[allow(async_fn_in_trait)] |
10 |
11 |
async fn foo(&'a self, key: &'b T) -> (&'a Self, &'b T) where T: Debug + Sized; |
11 |
12 |
} |
12 |
13 |
|
Original file line number |
Diff line number |
Diff line change |
@@ -5,6 +5,7 @@ |
|
|
5 |
5 |
#![allow(incomplete_features)] |
6 |
6 |
|
7 |
7 |
trait MyTrait<'a, 'b, T> { |
|
8 |
+#[allow(async_fn_in_trait)] |
8 |
9 |
async fn foo(&'a self, key: &'b T) -> (&'a Self, &'b T); |
9 |
10 |
} |
10 |
11 |
|
Original file line number |
Diff line number |
Diff line change |
@@ -5,6 +5,7 @@ |
|
|
5 |
5 |
#![allow(incomplete_features)] |
6 |
6 |
|
7 |
7 |
pub trait Foo { |
|
8 |
+#[allow(async_fn_in_trait)] |
8 |
9 |
async fn foo(&mut self); |
9 |
10 |
} |
10 |
11 |
|
Original file line number |
Diff line number |
Diff line change |
@@ -5,6 +5,7 @@ |
|
|
5 |
5 |
#![allow(incomplete_features)] |
6 |
6 |
|
7 |
7 |
pub trait Foo { |
|
8 |
+#[allow(async_fn_in_trait)] |
8 |
9 |
async fn foo(&mut self); |
9 |
10 |
} |
10 |
11 |
|
Original file line number |
Diff line number |
Diff line change |
@@ -7,6 +7,8 @@ |
|
|
7 |
7 |
trait TcpStack { |
8 |
8 |
type Connection<'a>: Sized where Self: 'a; |
9 |
9 |
fn connect<'a>(&'a self) -> Self::Connection<'a>; |
|
10 |
+ |
|
11 |
+#[allow(async_fn_in_trait)] |
10 |
12 |
async fn async_connect<'a>(&'a self) -> Self::Connection<'a>; |
11 |
13 |
} |
12 |
14 |
|
Original file line number |
Diff line number |
Diff line change |
@@ -10,6 +10,8 @@ async fn yield_now() {} |
|
|
10 |
10 |
|
11 |
11 |
trait AsyncIterator { |
12 |
12 |
type Item; |
|
13 |
+ |
|
14 |
+#[allow(async_fn_in_trait)] |
13 |
15 |
async fn next(&mut self) -> OptionSelf::Item\; |
14 |
16 |
} |
15 |
17 |
|
Original file line number |
Diff line number |
Diff line change |
@@ -6,5 +6,6 @@ |
|
|
6 |
6 |
#![allow(incomplete_features)] |
7 |
7 |
|
8 |
8 |
trait T { |
|
9 |
+#[allow(async_fn_in_trait)] |
9 |
10 |
async fn foo(); |
10 |
11 |
} |
Original file line number |
Diff line number |
Diff line change |
@@ -5,6 +5,7 @@ |
|
|
5 |
5 |
#![allow(incomplete_features)] |
6 |
6 |
|
7 |
7 |
pub trait SpiDevice { |
|
8 |
+#[allow(async_fn_in_trait)] |
8 |
9 |
async fn transaction<F, R>(&mut self); |
9 |
10 |
} |
10 |
11 |
|
Original file line number |
Diff line number |
Diff line change |
@@ -8,6 +8,7 @@ use std::future::Future; |
|
|
8 |
8 |
pub trait Pool { |
9 |
9 |
type Conn; |
10 |
10 |
|
|
11 |
+#[allow(async_fn_in_trait)] |
11 |
12 |
async fn async_callback<'a, F: FnOnce(&'a Self::Conn) -> Fut, Fut: Future<Output = ()>>( |
12 |
13 |
&'a self, |
13 |
14 |
callback: F, |
Original file line number |
Diff line number |
Diff line change |
@@ -9,6 +9,7 @@ use std::future::Future; |
|
|
9 |
9 |
use std:📑:PhantomData; |
10 |
10 |
|
11 |
11 |
trait Lockable<K, V> { |
|
12 |
+#[allow(async_fn_in_trait)] |
12 |
13 |
async fn lock_all_entries(&self) -> impl Future<Output = Guard<'_>>; |
13 |
14 |
} |
14 |
15 |
|
Original file line number |
Diff line number |
Diff line change |
@@ -11,6 +11,7 @@ |
|
|
11 |
11 |
pub struct SharedState {} |
12 |
12 |
|
13 |
13 |
pub trait State { |
|
14 |
+#[allow(async_fn_in_trait)] |
14 |
15 |
async fn execute(self, shared_state: &SharedState); |
15 |
16 |
} |
16 |
17 |
|
| Original file line number | Diff line number | Diff line change | |
| -------------------------------------------------------- | -------------------------------------------------------- | ---------------------------------------------------------------------------------------- | |
| @@ -1,5 +1,5 @@ | | | |
| 1 | 1 | error[E0658]: return type notation is experimental | |
| 2 | | - --> $DIR/feature-gate-return_type_notation.rs:14:17 | |
| | 2 | + --> $DIR/feature-gate-return_type_notation.rs:15:17 | | |
| 3 | 3 | | | |
| 4 | 4 | LL | fn foo<T: Trait<m(): Send>>() {} | |
| 5 | 5 | | ^^^^^^^^^ | |
| @@ -8,15 +8,15 @@ LL | fn foo<T: Trait<m(): Send>>() {} | | | |
| 8 | 8 | = help: add `#![feature(return_type_notation)]` to the crate attributes to enable | |
| 9 | 9 | | |
| 10 | 10 | error: parenthesized generic arguments cannot be used in associated type constraints | |
| 11 | | - --> $DIR/feature-gate-return_type_notation.rs:14:17 | |
| | 11 | + --> $DIR/feature-gate-return_type_notation.rs:15:17 | | |
| 12 | 12 | | | |
| 13 | 13 | LL | fn foo<T: Trait<m(): Send>>() {} | |
| 14 | 14 | | ^-- | |
| 15 | 15 | | | |
| 16 | 16 | | help: remove these parentheses | |
| 17 | 17 | | |
| 18 | 18 | error[E0220]: associated type `m` not found for `Trait` | |
| 19 | | - --> $DIR/feature-gate-return_type_notation.rs:14:17 | |
| | 19 | + --> $DIR/feature-gate-return_type_notation.rs:15:17 | | |
| 20 | 20 | | | |
| 21 | 21 | LL | fn foo<T: Trait<m(): Send>>() {} | |
| 22 | 22 | | ^ associated type `m` not found | |
Original file line number |
Diff line number |
Diff line change |
@@ -1,5 +1,5 @@ |
|
|
1 |
1 |
warning: return type notation is experimental |
2 |
|
- --> $DIR/feature-gate-return_type_notation.rs:14:17 |
|
2 |
+ --> $DIR/feature-gate-return_type_notation.rs:15:17 |
3 |
3 |
| |
4 |
4 |
LL | fn foo<T: Trait<m(): Send>>() {} |
5 |
5 |
| ^^^^^^^^^ |
Original file line number |
Diff line number |
Diff line change |
@@ -7,6 +7,7 @@ |
|
|
7 |
7 |
#![feature(async_fn_in_trait)] |
8 |
8 |
|
9 |
9 |
trait Trait { |
|
10 |
+#[allow(async_fn_in_trait)] |
10 |
11 |
async fn m(); |
11 |
12 |
} |
12 |
13 |
|
Original file line number |
Diff line number |
Diff line change |
@@ -9,6 +9,7 @@ trait AsyncLendingIterator { |
|
|
9 |
9 |
where |
10 |
10 |
Self: 'a; |
11 |
11 |
|
|
12 |
+#[allow(async_fn_in_trait)] |
12 |
13 |
async fn next(&mut self) -> Option<Self::Item<'_>>; |
13 |
14 |
} |
14 |
15 |
|
Original file line number |
Diff line number |
Diff line change |
@@ -7,6 +7,7 @@ |
|
|
7 |
7 |
use std::fmt::Debug; |
8 |
8 |
|
9 |
9 |
trait Foo { |
|
10 |
+#[allow(async_fn_in_trait)] |
10 |
11 |
async fn baz(&self) -> impl Debug { |
11 |
12 |
"" |
12 |
13 |
} |
Original file line number |
Diff line number |
Diff line change |
@@ -7,6 +7,7 @@ |
|
|
7 |
7 |
use std::fmt::Debug; |
8 |
8 |
|
9 |
9 |
trait Foo { |
|
10 |
+#[allow(async_fn_in_trait)] |
10 |
11 |
async fn baz(&self) -> &str { |
11 |
12 |
"" |
12 |
13 |
} |
Original file line number |
Diff line number |
Diff line change |
@@ -5,6 +5,7 @@ |
|
|
5 |
5 |
#![allow(incomplete_features)] |
6 |
6 |
|
7 |
7 |
pub trait Foo { |
|
8 |
+#[allow(async_fn_in_trait)] |
8 |
9 |
async fn bar<'a: 'a>(&'a mut self); |
9 |
10 |
} |
10 |
11 |
|
Original file line number |
Diff line number |
Diff line change |
@@ -4,12 +4,15 @@ |
|
|
4 |
4 |
#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)] |
5 |
5 |
|
6 |
6 |
trait Trait { |
|
7 |
+ #[allow(async_fn_in_trait)] |
7 |
8 |
async fn foo(); |
8 |
9 |
|
|
10 |
+ #[allow(async_fn_in_trait)] |
9 |
11 |
async fn bar() -> i32; |
10 |
12 |
|
11 |
13 |
fn test(&self) -> impl Sized + '_; |
12 |
14 |
|
|
15 |
+ #[allow(async_fn_in_trait)] |
13 |
16 |
async fn baz(&self) -> &i32; |
14 |
17 |
} |
15 |
18 |
|
Original file line number |
Diff line number |
Diff line change |
@@ -4,12 +4,15 @@ |
|
|
4 |
4 |
#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)] |
5 |
5 |
|
6 |
6 |
trait Trait { |
|
7 |
+#[allow(async_fn_in_trait)] |
7 |
8 |
async fn foo(); |
8 |
9 |
|
|
10 |
+#[allow(async_fn_in_trait)] |
9 |
11 |
async fn bar() -> i32; |
10 |
12 |
|
11 |
13 |
fn test(&self) -> impl Sized + '_; |
12 |
14 |
|
|
15 |
+#[allow(async_fn_in_trait)] |
13 |
16 |
async fn baz(&self) -> &i32; |
14 |
17 |
} |
15 |
18 |
|
Original file line number |
Diff line number |
Diff line change |
@@ -1,15 +1,15 @@ |
|
|
1 |
1 |
error[E0046]: not all trait items implemented, missing: `foo`, `bar`, `test`, `baz` |
2 |
|
- --> $DIR/suggest-missing-item.rs🔞1 |
|
2 |
+ --> $DIR/suggest-missing-item.rs:21:1 |
3 |
3 |
| |
4 |
4 |
LL | async fn foo(); |
5 |
5 |
| --------------- `foo` from trait |
6 |
|
-LL | |
|
6 |
+... |
7 |
7 |
LL | async fn bar() -> i32; |
8 |
8 |
| ---------------------- `bar` from trait |
9 |
9 |
LL | |
10 |
10 |
LL | fn test(&self) -> impl Sized + '_; |
11 |
11 |
| ---------------------------------- `test` from trait |
12 |
|
-LL | |
|
12 |
+... |
13 |
13 |
LL | async fn baz(&self) -> &i32; |
14 |
14 |
| ---------------------------- `baz` from trait |
15 |
15 |
... |