mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-29 12:36:35 +03:00
Rollup merge of #110203 - compiler-errors:rtn-dots, r=eholk
Remove `..` from return type notation `@nikomatsakis` and I decided that using `..` in the return-type notation syntax is probably overkill. r? `@eholk` since you reviewed the last one Since this is piggybacking now totally off of a pre-existing syntax (parenthesized generics), let me know if you need any explanation of the logic here, since it's a bit more complicated now.
This commit is contained in:
@@ -12,11 +12,11 @@ fn foo<T: Trait<method(i32): Send>>() {}
|
||||
//~^ ERROR argument types not allowed with return type notation
|
||||
//~| ERROR associated type bounds are unstable
|
||||
|
||||
fn bar<T: Trait<method(..) -> (): Send>>() {}
|
||||
fn bar<T: Trait<method() -> (): Send>>() {}
|
||||
//~^ ERROR return type not allowed with return type notation
|
||||
|
||||
fn baz<T: Trait<method(): Send>>() {}
|
||||
//~^ ERROR return type notation arguments must be elided with `..`
|
||||
//~| ERROR associated type bounds are unstable
|
||||
|
||||
fn baz<T: Trait<method(..): Send>>() {}
|
||||
//~^ ERROR return type notation uses `()` instead of `(..)` for elided arguments
|
||||
|
||||
fn main() {}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
error: return type not allowed with return type notation
|
||||
--> $DIR/bad-inputs-and-output.rs:15:28
|
||||
error: return type notation uses `()` instead of `(..)` for elided arguments
|
||||
--> $DIR/bad-inputs-and-output.rs:19:24
|
||||
|
|
||||
LL | fn bar<T: Trait<method(..) -> (): Send>>() {}
|
||||
| ^^^^^ help: remove the return type
|
||||
LL | fn baz<T: Trait<method(..): Send>>() {}
|
||||
| ^^ help: remove the `..`
|
||||
|
||||
error[E0658]: associated type bounds are unstable
|
||||
--> $DIR/bad-inputs-and-output.rs:11:17
|
||||
@@ -14,10 +14,10 @@ LL | fn foo<T: Trait<method(i32): Send>>() {}
|
||||
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: associated type bounds are unstable
|
||||
--> $DIR/bad-inputs-and-output.rs:18:17
|
||||
--> $DIR/bad-inputs-and-output.rs:15:17
|
||||
|
|
||||
LL | fn baz<T: Trait<method(): Send>>() {}
|
||||
| ^^^^^^^^^^^^^^
|
||||
LL | fn bar<T: Trait<method() -> (): Send>>() {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
|
||||
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
|
||||
@@ -43,13 +43,13 @@ error: argument types not allowed with return type notation
|
||||
--> $DIR/bad-inputs-and-output.rs:11:23
|
||||
|
|
||||
LL | fn foo<T: Trait<method(i32): Send>>() {}
|
||||
| ^^^^^ help: remove the input types: `(..)`
|
||||
| ^^^^^ help: remove the input types: `()`
|
||||
|
||||
error: return type notation arguments must be elided with `..`
|
||||
--> $DIR/bad-inputs-and-output.rs:18:23
|
||||
error: return type not allowed with return type notation
|
||||
--> $DIR/bad-inputs-and-output.rs:15:25
|
||||
|
|
||||
LL | fn baz<T: Trait<method(): Send>>() {}
|
||||
| ^^ help: add `..`: `(..)`
|
||||
LL | fn bar<T: Trait<method() -> (): Send>>() {}
|
||||
| ^^^^^^ help: remove the return type
|
||||
|
||||
error: aborting due to 5 previous errors; 2 warnings emitted
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ async fn foo<T: Foo>() -> Result<(), ()> {
|
||||
fn is_send(_: impl Send) {}
|
||||
|
||||
fn test<
|
||||
#[cfg(with)] T: Foo<method(..): Send>,
|
||||
#[cfg(with)] T: Foo<method(): Send>,
|
||||
#[cfg(without)] T: Foo,
|
||||
>() {
|
||||
is_send(foo::<T>());
|
||||
|
||||
@@ -10,7 +10,7 @@ trait Trait {
|
||||
async fn method() {}
|
||||
}
|
||||
|
||||
fn test<T: Trait<method(..) = Box<dyn Future<Output = ()>>>>() {}
|
||||
fn test<T: Trait<method() = Box<dyn Future<Output = ()>>>>() {}
|
||||
//~^ ERROR return type notation is not allowed to use type equality
|
||||
|
||||
fn main() {}
|
||||
|
||||
@@ -18,8 +18,8 @@ LL | #![feature(return_type_notation, async_fn_in_trait)]
|
||||
error: return type notation is not allowed to use type equality
|
||||
--> $DIR/equality.rs:13:18
|
||||
|
|
||||
LL | fn test<T: Trait<method(..) = Box<dyn Future<Output = ()>>>>() {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | fn test<T: Trait<method() = Box<dyn Future<Output = ()>>>>() {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error; 2 warnings emitted
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ trait Trait {
|
||||
async fn method() {}
|
||||
}
|
||||
|
||||
fn bar<T: Trait<methid(..): Send>>() {}
|
||||
fn bar<T: Trait<methid(): Send>>() {}
|
||||
//~^ ERROR cannot find associated function `methid` in trait `Trait`
|
||||
|
||||
fn main() {}
|
||||
|
||||
@@ -18,8 +18,8 @@ LL | #![feature(return_type_notation, async_fn_in_trait)]
|
||||
error: cannot find associated function `methid` in trait `Trait`
|
||||
--> $DIR/missing.rs:11:17
|
||||
|
|
||||
LL | fn bar<T: Trait<methid(..): Send>>() {}
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
LL | fn bar<T: Trait<methid(): Send>>() {}
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error; 2 warnings emitted
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ trait Trait {
|
||||
fn method() {}
|
||||
}
|
||||
|
||||
fn test<T: Trait<method(..): Send>>() {}
|
||||
fn test<T: Trait<method(): Send>>() {}
|
||||
//~^ ERROR return type notation used on function that is not `async` and does not return `impl Trait`
|
||||
|
||||
fn main() {}
|
||||
|
||||
@@ -13,8 +13,8 @@ error: return type notation used on function that is not `async` and does not re
|
||||
LL | fn method() {}
|
||||
| ----------- this function must be `async` or return `impl Trait`
|
||||
...
|
||||
LL | fn test<T: Trait<method(..): Send>>() {}
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
LL | fn test<T: Trait<method(): Send>>() {}
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: function returns `()`, which is not compatible with associated type return bounds
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
error[E0658]: return type notation is experimental
|
||||
--> $DIR/feature-gate-return_type_notation.rs:12:18
|
||||
--> $DIR/feature-gate-return_type_notation.rs:15:17
|
||||
|
|
||||
LL | fn foo<T: Trait<m(..): Send>>() {}
|
||||
| ^^^^
|
||||
LL | fn foo<T: Trait<m(): Send>>() {}
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
|
||||
= help: add `#![feature(return_type_notation)]` to the crate attributes to enable
|
||||
|
||||
warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/feature-gate-return_type_notation.rs:4:12
|
||||
--> $DIR/feature-gate-return_type_notation.rs:7:12
|
||||
|
|
||||
LL | #![feature(async_fn_in_trait)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
@@ -16,6 +16,21 @@ LL | #![feature(async_fn_in_trait)]
|
||||
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
error: aborting due to previous error; 1 warning emitted
|
||||
error: parenthesized generic arguments cannot be used in associated type constraints
|
||||
--> $DIR/feature-gate-return_type_notation.rs:15:17
|
||||
|
|
||||
LL | fn foo<T: Trait<m(): Send>>() {}
|
||||
| ^--
|
||||
| |
|
||||
| help: remove these parentheses
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
error[E0220]: associated type `m` not found for `Trait`
|
||||
--> $DIR/feature-gate-return_type_notation.rs:15:17
|
||||
|
|
||||
LL | fn foo<T: Trait<m(): Send>>() {}
|
||||
| ^ associated type `m` not found
|
||||
|
||||
error: aborting due to 3 previous errors; 1 warning emitted
|
||||
|
||||
Some errors have detailed explanations: E0220, E0658.
|
||||
For more information about an error, try `rustc --explain E0220`.
|
||||
|
||||
@@ -1,14 +1,5 @@
|
||||
error[E0658]: return type notation is experimental
|
||||
--> $DIR/feature-gate-return_type_notation.rs:12:18
|
||||
|
|
||||
LL | fn foo<T: Trait<m(..): Send>>() {}
|
||||
| ^^^^
|
||||
|
|
||||
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
|
||||
= help: add `#![feature(return_type_notation)]` to the crate attributes to enable
|
||||
|
||||
warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/feature-gate-return_type_notation.rs:4:12
|
||||
--> $DIR/feature-gate-return_type_notation.rs:7:12
|
||||
|
|
||||
LL | #![feature(async_fn_in_trait)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
@@ -16,6 +7,16 @@ LL | #![feature(async_fn_in_trait)]
|
||||
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
error: aborting due to previous error; 1 warning emitted
|
||||
warning: return type notation is experimental
|
||||
--> $DIR/feature-gate-return_type_notation.rs:15:17
|
||||
|
|
||||
LL | fn foo<T: Trait<m(): Send>>() {}
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
|
||||
= help: add `#![feature(return_type_notation)]` to the crate attributes to enable
|
||||
= warning: unstable syntax can change at any point in the future, causing a hard error!
|
||||
= note: for more information, see issue #65860 <https://github.com/rust-lang/rust/issues/65860>
|
||||
|
||||
warning: 2 warnings emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
// edition: 2021
|
||||
// revisions: cfg no
|
||||
|
||||
//[no] check-pass
|
||||
// Since we're not adding new syntax, `cfg`'d out RTN must pass.
|
||||
|
||||
#![feature(async_fn_in_trait)]
|
||||
//~^ WARN the feature `async_fn_in_trait` is incomplete
|
||||
|
||||
@@ -9,7 +12,11 @@ trait Trait {
|
||||
}
|
||||
|
||||
#[cfg(cfg)]
|
||||
fn foo<T: Trait<m(..): Send>>() {}
|
||||
//~^ ERROR return type notation is experimental
|
||||
fn foo<T: Trait<m(): Send>>() {}
|
||||
//[cfg]~^ ERROR return type notation is experimental
|
||||
//[cfg]~| ERROR parenthesized generic arguments cannot be used in associated type constraints
|
||||
//[cfg]~| ERROR associated type `m` not found for `Trait`
|
||||
//[no]~^^^^ WARN return type notation is experimental
|
||||
//[no]~| WARN unstable syntax can change at any point in the future, causing a hard error!
|
||||
|
||||
fn main() {}
|
||||
|
||||
Reference in New Issue
Block a user