-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #111047 - compiler-errors:rtn-no-ty-ct-params, r=spasto…
…rino Emit an error when return-type-notation is used with type/const params These are not intended to be supported initially, even though the compiler supports them internally...
- Loading branch information
Showing
8 changed files
with
100 additions
and
44 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
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
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
20 changes: 20 additions & 0 deletions
20
tests/ui/async-await/return-type-notation/ty-or-ct-params.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,20 @@ | ||
// edition: 2021 | ||
|
||
#![feature(async_fn_in_trait, return_type_notation)] | ||
//~^ WARN the feature `return_type_notation` is incomplete | ||
|
||
trait Foo { | ||
async fn bar<T>() {} | ||
|
||
async fn baz<const N: usize>() {} | ||
} | ||
|
||
fn test<T>() | ||
where | ||
T: Foo<bar(): Send, baz(): Send>, | ||
//~^ ERROR return type notation is not allowed for functions that have const parameters | ||
//~| ERROR return type notation is not allowed for functions that have type parameters | ||
{ | ||
} | ||
|
||
fn main() {} |
29 changes: 29 additions & 0 deletions
29
tests/ui/async-await/return-type-notation/ty-or-ct-params.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,29 @@ | ||
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes | ||
--> $DIR/ty-or-ct-params.rs:3:31 | ||
| | ||
LL | #![feature(async_fn_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 | ||
|
||
error: return type notation is not allowed for functions that have type parameters | ||
--> $DIR/ty-or-ct-params.rs:14:12 | ||
| | ||
LL | async fn bar<T>() {} | ||
| - type parameter declared here | ||
... | ||
LL | T: Foo<bar(): Send, baz(): Send>, | ||
| ^^^^^^^^^^^ | ||
|
||
error: return type notation is not allowed for functions that have const parameters | ||
--> $DIR/ty-or-ct-params.rs:14:25 | ||
| | ||
LL | async fn baz<const N: usize>() {} | ||
| -------------- const parameter declared here | ||
... | ||
LL | T: Foo<bar(): Send, baz(): Send>, | ||
| ^^^^^^^^^^^ | ||
|
||
error: aborting due to 2 previous errors; 1 warning emitted | ||
|