rust/tests/ui/traits/next-solver/coroutine.fail.stderr
Oli Scherer aef0f4024a Error on using yield without also using #[coroutine] on the closure
And suggest adding the `#[coroutine]` to the closure
2024-04-24 08:05:29 +00:00

65 lines
2.2 KiB
Plaintext

error[E0277]: the trait bound `{coroutine@$DIR/coroutine.rs:20:9: 20:11}: Coroutine<A>` is not satisfied
--> $DIR/coroutine.rs:20:9
|
LL | needs_coroutine(
| --------------- required by a bound introduced by this call
LL | #[coroutine]
LL | / || {
LL | |
LL | |
LL | |
LL | | yield ();
LL | | },
| |_________^ the trait `Coroutine<A>` is not implemented for `{coroutine@$DIR/coroutine.rs:20:9: 20:11}`
|
note: required by a bound in `needs_coroutine`
--> $DIR/coroutine.rs:14:28
|
LL | fn needs_coroutine(_: impl Coroutine<A, Yield = B, Return = C>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `needs_coroutine`
error[E0271]: type mismatch resolving `<{coroutine@$DIR/coroutine.rs:20:9: 20:11} as Coroutine<A>>::Yield == B`
--> $DIR/coroutine.rs:20:9
|
LL | needs_coroutine(
| --------------- required by a bound introduced by this call
LL | #[coroutine]
LL | / || {
LL | |
LL | |
LL | |
LL | | yield ();
LL | | },
| |_________^ types differ
|
note: required by a bound in `needs_coroutine`
--> $DIR/coroutine.rs:14:41
|
LL | fn needs_coroutine(_: impl Coroutine<A, Yield = B, Return = C>) {}
| ^^^^^^^^^ required by this bound in `needs_coroutine`
error[E0271]: type mismatch resolving `<{coroutine@$DIR/coroutine.rs:20:9: 20:11} as Coroutine<A>>::Return == C`
--> $DIR/coroutine.rs:20:9
|
LL | needs_coroutine(
| --------------- required by a bound introduced by this call
LL | #[coroutine]
LL | / || {
LL | |
LL | |
LL | |
LL | | yield ();
LL | | },
| |_________^ types differ
|
note: required by a bound in `needs_coroutine`
--> $DIR/coroutine.rs:14:52
|
LL | fn needs_coroutine(_: impl Coroutine<A, Yield = B, Return = C>) {}
| ^^^^^^^^^^ required by this bound in `needs_coroutine`
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0271, E0277.
For more information about an error, try `rustc --explain E0271`.