Skip to content

Commit

Permalink
Bless tests
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Oct 3, 2023
1 parent ec79720 commit 28d58f6
Show file tree
Hide file tree
Showing 26 changed files with 40 additions and 7 deletions.
2 changes: 2 additions & 0 deletions tests/ui/async-await/in-trait/async-associated-types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/async-await/in-trait/async-default-fn-overridden.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions tests/ui/async-await/in-trait/async-example-desugared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use std::future::Future;

trait MyTrait {
#[allow(async_fn_in_trait)]
async fn foo(&self) -> i32;
}

Expand Down
3 changes: 3 additions & 0 deletions tests/ui/async-await/in-trait/async-example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions tests/ui/async-await/in-trait/async-lifetimes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
1 change: 1 addition & 0 deletions tests/ui/async-await/in-trait/early-bound-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#![allow(incomplete_features)]

pub trait Foo {
#[allow(async_fn_in_trait)]
async fn foo(&mut self);
}

Expand Down
1 change: 1 addition & 0 deletions tests/ui/async-await/in-trait/early-bound-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#![allow(incomplete_features)]

pub trait Foo {
#[allow(async_fn_in_trait)]
async fn foo(&mut self);
}

Expand Down
2 changes: 2 additions & 0 deletions tests/ui/async-await/in-trait/implied-bounds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
}

Expand Down
2 changes: 2 additions & 0 deletions tests/ui/async-await/in-trait/issue-102138.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
}

Expand Down
1 change: 1 addition & 0 deletions tests/ui/async-await/in-trait/issue-102219.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
#![allow(incomplete_features)]

trait T {
#[allow(async_fn_in_trait)]
async fn foo();
}
1 change: 1 addition & 0 deletions tests/ui/async-await/in-trait/issue-102310.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#![allow(incomplete_features)]

pub trait SpiDevice {
#[allow(async_fn_in_trait)]
async fn transaction<F, R>(&mut self);
}

Expand Down
1 change: 1 addition & 0 deletions tests/ui/async-await/in-trait/issue-104678.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions tests/ui/async-await/in-trait/nested-rpit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<'_>>;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
pub struct SharedState {}

pub trait State {
#[allow(async_fn_in_trait)]
async fn execute(self, shared_state: &SharedState);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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>>() {}
| ^^^^^^^^^
Expand All @@ -8,15 +8,15 @@ 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>>() {}
| ^--
| |
| 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
Expand Down
Original file line number Diff line number Diff line change
@@ -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>>() {}
| ^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#![feature(async_fn_in_trait)]

trait Trait {
#[allow(async_fn_in_trait)]
async fn m();
}

Expand Down
1 change: 1 addition & 0 deletions tests/ui/impl-trait/in-trait/assumed-wf-bounds-in-impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ trait AsyncLendingIterator {
where
Self: 'a;

#[allow(async_fn_in_trait)]
async fn next(&mut self) -> Option<Self::Item<'_>>;
}

Expand Down
1 change: 1 addition & 0 deletions tests/ui/impl-trait/in-trait/default-body-with-rpit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use std::fmt::Debug;

trait Foo {
#[allow(async_fn_in_trait)]
async fn baz(&self) -> impl Debug {
""
}
Expand Down
1 change: 1 addition & 0 deletions tests/ui/impl-trait/in-trait/default-body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use std::fmt::Debug;

trait Foo {
#[allow(async_fn_in_trait)]
async fn baz(&self) -> &str {
""
}
Expand Down
1 change: 1 addition & 0 deletions tests/ui/impl-trait/in-trait/early.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#![allow(incomplete_features)]

pub trait Foo {
#[allow(async_fn_in_trait)]
async fn bar<'a: 'a>(&'a mut self);
}

Expand Down
3 changes: 3 additions & 0 deletions tests/ui/impl-trait/in-trait/suggest-missing-item.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
3 changes: 3 additions & 0 deletions tests/ui/impl-trait/in-trait/suggest-missing-item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
6 changes: 3 additions & 3 deletions tests/ui/impl-trait/in-trait/suggest-missing-item.stderr
Original file line number Diff line number Diff line change
@@ -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
...
Expand Down

0 comments on commit 28d58f6

Please sign in to comment.