rust-lang / rust-lang/rust

E0308 for coroutines kinda cryptic

Open
#118,954 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-coroutines A-diagnostics F-coroutines S-waiting-on-author T-compiler
Dominant language
Rust
Stars
119k
Forks
16.2k
PR merge metrics
PR metrics pending

Description

Code
#![feature(coroutines)]
#![crate_type="lib"]

async fn async_fn() -> i32 {
    move || {
        yield 1_u32;
    }
}
Current output
error[E0308]: mismatched types
 --> 94BA3E9349D8E32F911462C954A9A278963282E62BF874B0EED4F13C0EFFE468.rs:5:5
  |
5 | /     move || {
6 | |         yield 1_u32;
7 | |     }
  | |_____^ expected `i32`, found coroutine
  |
  = note:   expected type `i32`
          found coroutine `{coroutine@94BA3E9349D8E32F911462C954A9A278963282E62BF874B0EED4F13C0EFFE468.rs:5:5: 5:12}`

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0308`.
Desired output
`found coroutine<u32>`   or something like that?
Rationale and extra context

No response

Other cases

No response

Anything else?

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by compiling the Rust reproducer in the issue and compare its current E0308 output with the requested coroutine type wording. No source file or test is named, so locate the compiler diagnostic path responsible for this output. Done means the diagnostic identifies the yielded coroutine type more clearly and the existing behavior is covered by a test.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.