-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make associated type bounds in supertrait position implied
- Loading branch information
1 parent
3c554f5
commit 858a861
Showing
4 changed files
with
112 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// check-pass | ||
|
||
#![feature(associated_type_bounds)] | ||
|
||
trait Trait: Super<Assoc: Bound> {} | ||
|
||
trait Super { | ||
type Assoc; | ||
} | ||
|
||
trait Bound {} | ||
|
||
fn foo<T>(x: T) | ||
where | ||
T: Trait, | ||
{ | ||
} | ||
|
||
fn main() {} |
28 changes: 28 additions & 0 deletions
28
tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// edition:2021 | ||
// check-pass | ||
|
||
#![feature(async_fn_in_trait, return_position_impl_trait_in_trait, return_type_notation)] | ||
//~^ WARN the feature `return_type_notation` is incomplete | ||
|
||
use std::future::Future; | ||
|
||
struct JoinHandle<T>(fn() -> T); | ||
|
||
fn spawn<T>(_: impl Future<Output = T>) -> JoinHandle<T> { | ||
todo!() | ||
} | ||
|
||
trait Foo { | ||
async fn bar(&self) -> i32; | ||
} | ||
|
||
trait SendFoo: Foo<bar(): Send> + Send {} | ||
|
||
fn foobar(foo: impl SendFoo) -> JoinHandle<i32> { | ||
spawn(async move { | ||
let future = foo.bar(); | ||
future.await | ||
}) | ||
} | ||
|
||
fn main() {} |
11 changes: 11 additions & 0 deletions
11
tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes | ||
--> $DIR/rtn-implied-in-supertrait.rs:4:68 | ||
| | ||
LL | #![feature(async_fn_in_trait, return_position_impl_trait_in_trait, return_type_notation)] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information | ||
= note: `#[warn(incomplete_features)]` on by default | ||
|
||
warning: 1 warning emitted | ||
|