-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix return type notation errors with -Zlower-impl-trait-in-trait-to-a…
…ssoc-ty
- Loading branch information
1 parent
54d6738
commit d77e55b
Showing
27 changed files
with
287 additions
and
25 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
48 changes: 48 additions & 0 deletions
48
tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.next.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,48 @@ | ||
error: return type notation uses `()` instead of `(..)` for elided arguments | ||
--> $DIR/bad-inputs-and-output.rs:20:24 | ||
| | ||
LL | fn baz<T: Trait<method(..): Send>>() {} | ||
| ^^ help: remove the `..` | ||
|
||
error[E0658]: associated type bounds are unstable | ||
--> $DIR/bad-inputs-and-output.rs:12:17 | ||
| | ||
LL | fn foo<T: Trait<method(i32): 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 | ||
|
||
error[E0658]: associated type bounds are unstable | ||
--> $DIR/bad-inputs-and-output.rs:16:17 | ||
| | ||
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 | ||
|
||
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes | ||
--> $DIR/bad-inputs-and-output.rs:5:12 | ||
| | ||
LL | #![feature(return_type_notation, async_fn_in_trait)] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information | ||
= note: `#[warn(incomplete_features)]` on by default | ||
|
||
error: argument types not allowed with return type notation | ||
--> $DIR/bad-inputs-and-output.rs:12:23 | ||
| | ||
LL | fn foo<T: Trait<method(i32): Send>>() {} | ||
| ^^^^^ help: remove the input types: `()` | ||
|
||
error: return type not allowed with return type notation | ||
--> $DIR/bad-inputs-and-output.rs:16:25 | ||
| | ||
LL | fn bar<T: Trait<method() -> (): Send>>() {} | ||
| ^^^^^^ help: remove the return type | ||
|
||
error: aborting due to 5 previous errors; 1 warning emitted | ||
|
||
For more information about this error, try `rustc --explain E0658`. |
2 changes: 2 additions & 0 deletions
2
tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.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
11 changes: 11 additions & 0 deletions
11
tests/ui/associated-type-bounds/return-type-notation/basic.current_with.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/basic.rs:8:12 | ||
| | ||
LL | #![feature(return_type_notation, async_fn_in_trait)] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= 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 | ||
|
29 changes: 29 additions & 0 deletions
29
tests/ui/associated-type-bounds/return-type-notation/basic.current_without.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/basic.rs:8:12 | ||
| | ||
LL | #![feature(return_type_notation, async_fn_in_trait)] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information | ||
= note: `#[warn(incomplete_features)]` on by default | ||
|
||
error: future cannot be sent between threads safely | ||
--> $DIR/basic.rs:26:13 | ||
| | ||
LL | is_send(foo::<T>()); | ||
| ^^^^^^^^^^ future returned by `foo` is not `Send` | ||
| | ||
= help: within `impl Future<Output = Result<(), ()>>`, the trait `Send` is not implemented for `impl Future<Output = Result<(), ()>>` | ||
note: future is not `Send` as it awaits another future which is not `Send` | ||
--> $DIR/basic.rs:16:5 | ||
| | ||
LL | T::method().await?; | ||
| ^^^^^^^^^^^ await occurs here on type `impl Future<Output = Result<(), ()>>`, which is not `Send` | ||
note: required by a bound in `is_send` | ||
--> $DIR/basic.rs:20:20 | ||
| | ||
LL | fn is_send(_: impl Send) {} | ||
| ^^^^ required by this bound in `is_send` | ||
|
||
error: aborting due to previous error; 1 warning emitted | ||
|
11 changes: 11 additions & 0 deletions
11
tests/ui/associated-type-bounds/return-type-notation/basic.next_with.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/basic.rs:8:12 | ||
| | ||
LL | #![feature(return_type_notation, async_fn_in_trait)] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= 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 | ||
|
29 changes: 29 additions & 0 deletions
29
tests/ui/associated-type-bounds/return-type-notation/basic.next_without.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/basic.rs:8:12 | ||
| | ||
LL | #![feature(return_type_notation, async_fn_in_trait)] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information | ||
= note: `#[warn(incomplete_features)]` on by default | ||
|
||
error: future cannot be sent between threads safely | ||
--> $DIR/basic.rs:26:13 | ||
| | ||
LL | is_send(foo::<T>()); | ||
| ^^^^^^^^^^ future returned by `foo` is not `Send` | ||
| | ||
= help: within `impl Future<Output = Result<(), ()>>`, the trait `Send` is not implemented for `impl Future<Output = Result<(), ()>>` | ||
note: future is not `Send` as it awaits another future which is not `Send` | ||
--> $DIR/basic.rs:16:5 | ||
| | ||
LL | T::method().await?; | ||
| ^^^^^^^^^^^ await occurs here on type `impl Future<Output = Result<(), ()>>`, which is not `Send` | ||
note: required by a bound in `is_send` | ||
--> $DIR/basic.rs:20:20 | ||
| | ||
LL | fn is_send(_: impl Send) {} | ||
| ^^^^ required by this bound in `is_send` | ||
|
||
error: aborting due to previous error; 1 warning emitted | ||
|
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
17 changes: 17 additions & 0 deletions
17
tests/ui/associated-type-bounds/return-type-notation/equality.next.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,17 @@ | ||
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes | ||
--> $DIR/equality.rs:5:12 | ||
| | ||
LL | #![feature(return_type_notation, async_fn_in_trait)] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= 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 to use type equality | ||
--> $DIR/equality.rs:14:18 | ||
| | ||
LL | fn test<T: Trait<method() = Box<dyn Future<Output = ()>>>>() {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error; 1 warning emitted | ||
|
2 changes: 2 additions & 0 deletions
2
tests/ui/associated-type-bounds/return-type-notation/equality.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
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
37 changes: 37 additions & 0 deletions
37
tests/ui/async-await/return-type-notation/issue-110963-early.next.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,37 @@ | ||
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes | ||
--> $DIR/issue-110963-early.rs:6:12 | ||
| | ||
LL | #![feature(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: higher-ranked lifetime error | ||
--> $DIR/issue-110963-early.rs:17:5 | ||
| | ||
LL | / spawn(async move { | ||
LL | | let mut hc = hc; | ||
LL | | if !hc.check().await { | ||
LL | | log_health_check_failure().await; | ||
LL | | } | ||
LL | | }); | ||
| |______^ | ||
| | ||
= note: could not prove `[async block@$DIR/issue-110963-early.rs:17:11: 22:6]: Send` | ||
|
||
error: higher-ranked lifetime error | ||
--> $DIR/issue-110963-early.rs:17:5 | ||
| | ||
LL | / spawn(async move { | ||
LL | | let mut hc = hc; | ||
LL | | if !hc.check().await { | ||
LL | | log_health_check_failure().await; | ||
LL | | } | ||
LL | | }); | ||
| |______^ | ||
| | ||
= note: could not prove `[async block@$DIR/issue-110963-early.rs:17:11: 22:6]: Send` | ||
|
||
error: aborting due to 2 previous errors; 1 warning emitted | ||
|
2 changes: 2 additions & 0 deletions
2
tests/ui/async-await/return-type-notation/issue-110963-early.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
2 changes: 1 addition & 1 deletion
2
...rn-type-notation/issue-110963-late.stderr → ...notation/issue-110963-late.current.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
11 changes: 11 additions & 0 deletions
11
tests/ui/async-await/return-type-notation/issue-110963-late.next.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/issue-110963-late.rs:6:12 | ||
| | ||
LL | #![feature(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 | ||
|
2 changes: 2 additions & 0 deletions
2
tests/ui/async-await/return-type-notation/issue-110963-late.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
2 changes: 1 addition & 1 deletion
2
...n-type-notation/super-method-bound.stderr → ...otation/super-method-bound.current.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
11 changes: 11 additions & 0 deletions
11
tests/ui/async-await/return-type-notation/super-method-bound.next.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/super-method-bound.rs:6: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 | ||
|
||
warning: 1 warning emitted | ||
|
Oops, something went wrong.