Bless tests

This commit is contained in:
Michael Goulet 2023-09-26 20:20:25 +00:00
parent ec79720c1e
commit 28d58f6524
26 changed files with 40 additions and 7 deletions

View file

@ -9,12 +9,14 @@ use std::fmt::Debug;
trait MyTrait<'a, 'b, T> where Self: 'a, T: Debug + Sized + 'b {
type MyAssoc;
#[allow(async_fn_in_trait)]
async fn foo(&'a self, key: &'b T) -> Self::MyAssoc;
}
impl<'a, 'b, T: Debug + Sized + 'b, U: 'a> MyTrait<'a, 'b, T> for U {
type MyAssoc = (&'a U, &'b T);
#[allow(async_fn_in_trait)]
async fn foo(&'a self, key: &'b T) -> (&'a U, &'b T) {
(self, key)
}

View file

@ -6,10 +6,12 @@
use std::future::Future;
trait AsyncTrait {
#[allow(async_fn_in_trait)]
async fn default_impl() {
assert!(false);
}
#[allow(async_fn_in_trait)]
async fn call_default_impl() {
Self::default_impl().await
}

View file

@ -10,6 +10,7 @@ use std::pin::Pin;
use std::task::Poll;
pub trait MyTrait {
#[allow(async_fn_in_trait)]
async fn foo(&self) -> i32;
}

View file

@ -8,6 +8,7 @@
use std::future::Future;
trait MyTrait {
#[allow(async_fn_in_trait)]
async fn foo(&self) -> i32;
}

View file

@ -5,7 +5,10 @@
#![allow(incomplete_features)]
trait MyTrait {
#[allow(async_fn_in_trait)]
async fn foo(&self) -> i32;
#[allow(async_fn_in_trait)]
async fn bar(&self) -> i32;
}

View file

@ -7,6 +7,7 @@
use std::fmt::Debug;
trait MyTrait<'a, 'b, T> {
#[allow(async_fn_in_trait)]
async fn foo(&'a self, key: &'b T) -> (&'a Self, &'b T) where T: Debug + Sized;
}

View file

@ -5,6 +5,7 @@
#![allow(incomplete_features)]
trait MyTrait<'a, 'b, T> {
#[allow(async_fn_in_trait)]
async fn foo(&'a self, key: &'b T) -> (&'a Self, &'b T);
}

View file

@ -5,6 +5,7 @@
#![allow(incomplete_features)]
pub trait Foo {
#[allow(async_fn_in_trait)]
async fn foo(&mut self);
}

View file

@ -5,6 +5,7 @@
#![allow(incomplete_features)]
pub trait Foo {
#[allow(async_fn_in_trait)]
async fn foo(&mut self);
}

View file

@ -7,6 +7,8 @@
trait TcpStack {
type Connection<'a>: Sized where Self: 'a;
fn connect<'a>(&'a self) -> Self::Connection<'a>;
#[allow(async_fn_in_trait)]
async fn async_connect<'a>(&'a self) -> Self::Connection<'a>;
}

View file

@ -10,6 +10,8 @@ async fn yield_now() {}
trait AsyncIterator {
type Item;
#[allow(async_fn_in_trait)]
async fn next(&mut self) -> Option<Self::Item>;
}

View file

@ -6,5 +6,6 @@
#![allow(incomplete_features)]
trait T {
#[allow(async_fn_in_trait)]
async fn foo();
}

View file

@ -5,6 +5,7 @@
#![allow(incomplete_features)]
pub trait SpiDevice {
#[allow(async_fn_in_trait)]
async fn transaction<F, R>(&mut self);
}

View file

@ -8,6 +8,7 @@ use std::future::Future;
pub trait Pool {
type Conn;
#[allow(async_fn_in_trait)]
async fn async_callback<'a, F: FnOnce(&'a Self::Conn) -> Fut, Fut: Future<Output = ()>>(
&'a self,
callback: F,

View file

@ -9,6 +9,7 @@ use std::future::Future;
use std::marker::PhantomData;
trait Lockable<K, V> {
#[allow(async_fn_in_trait)]
async fn lock_all_entries(&self) -> impl Future<Output = Guard<'_>>;
}

View file

@ -11,6 +11,7 @@
pub struct SharedState {}
pub trait State {
#[allow(async_fn_in_trait)]
async fn execute(self, shared_state: &SharedState);
}

View file

@ -1,5 +1,5 @@
error[E0658]: return type notation is experimental
--> $DIR/feature-gate-return_type_notation.rs:14:17
--> $DIR/feature-gate-return_type_notation.rs:15:17
|
LL | fn foo<T: Trait<m(): Send>>() {}
| ^^^^^^^^^
@ -8,7 +8,7 @@ LL | fn foo<T: Trait<m(): Send>>() {}
= help: add `#![feature(return_type_notation)]` to the crate attributes to enable
error: parenthesized generic arguments cannot be used in associated type constraints
--> $DIR/feature-gate-return_type_notation.rs:14:17
--> $DIR/feature-gate-return_type_notation.rs:15:17
|
LL | fn foo<T: Trait<m(): Send>>() {}
| ^--
@ -16,7 +16,7 @@ LL | fn foo<T: Trait<m(): Send>>() {}
| help: remove these parentheses
error[E0220]: associated type `m` not found for `Trait`
--> $DIR/feature-gate-return_type_notation.rs:14:17
--> $DIR/feature-gate-return_type_notation.rs:15:17
|
LL | fn foo<T: Trait<m(): Send>>() {}
| ^ associated type `m` not found

View file

@ -1,5 +1,5 @@
warning: return type notation is experimental
--> $DIR/feature-gate-return_type_notation.rs:14:17
--> $DIR/feature-gate-return_type_notation.rs:15:17
|
LL | fn foo<T: Trait<m(): Send>>() {}
| ^^^^^^^^^

View file

@ -7,6 +7,7 @@
#![feature(async_fn_in_trait)]
trait Trait {
#[allow(async_fn_in_trait)]
async fn m();
}

View file

@ -9,6 +9,7 @@ trait AsyncLendingIterator {
where
Self: 'a;
#[allow(async_fn_in_trait)]
async fn next(&mut self) -> Option<Self::Item<'_>>;
}

View file

@ -7,6 +7,7 @@
use std::fmt::Debug;
trait Foo {
#[allow(async_fn_in_trait)]
async fn baz(&self) -> impl Debug {
""
}

View file

@ -7,6 +7,7 @@
use std::fmt::Debug;
trait Foo {
#[allow(async_fn_in_trait)]
async fn baz(&self) -> &str {
""
}

View file

@ -5,6 +5,7 @@
#![allow(incomplete_features)]
pub trait Foo {
#[allow(async_fn_in_trait)]
async fn bar<'a: 'a>(&'a mut self);
}

View file

@ -4,12 +4,15 @@
#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
trait Trait {
#[allow(async_fn_in_trait)]
async fn foo();
#[allow(async_fn_in_trait)]
async fn bar() -> i32;
fn test(&self) -> impl Sized + '_;
#[allow(async_fn_in_trait)]
async fn baz(&self) -> &i32;
}

View file

@ -4,12 +4,15 @@
#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
trait Trait {
#[allow(async_fn_in_trait)]
async fn foo();
#[allow(async_fn_in_trait)]
async fn bar() -> i32;
fn test(&self) -> impl Sized + '_;
#[allow(async_fn_in_trait)]
async fn baz(&self) -> &i32;
}

View file

@ -1,15 +1,15 @@
error[E0046]: not all trait items implemented, missing: `foo`, `bar`, `test`, `baz`
--> $DIR/suggest-missing-item.rs:18:1
--> $DIR/suggest-missing-item.rs:21:1
|
LL | async fn foo();
| --------------- `foo` from trait
LL |
...
LL | async fn bar() -> i32;
| ---------------------- `bar` from trait
LL |
LL | fn test(&self) -> impl Sized + '_;
| ---------------------------------- `test` from trait
LL |
...
LL | async fn baz(&self) -> &i32;
| ---------------------------- `baz` from trait
...