rust-lang / rust-lang/rust

same diagnostic repeated 5 times

Open
#156,080 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

A-diagnostics D-verbose T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Code
#![feature(yield_expr, iter_macro)]
use std::iter::iter;
use std::pin::pin;
use std::task::{Context, Waker};
async fn call_async_once(f: impl AsyncFnOnce()) {
    f().await
}
fn main() {
    let f = iter! { || yield};
    pin!(call_async_once(f)).poll(&mut Context::from_waker(Waker::noop()));
}
Current output
error[E0277]: the trait bound `{gen closure@a.rs:9:21: 9:23}: AsyncFnOnce()` is not satisfied
  --> a.rs:10:26
   |
10 |     pin!(call_async_once(f)).poll(&mut Context::from_waker(Waker::noop()));
   |          --------------- ^ the trait `AsyncFnOnce()` is not implemented for `{gen closure@a.rs:9:21: 9:23}`
   |          |
   |          required by a bound introduced by this call
   |
note: required by a bound in `call_async_once`
  --> a.rs:5:34
   |
 5 | async fn call_async_once(f: impl AsyncFnOnce()) {
   |                                  ^^^^^^^^^^^^^ required by this bound in `call_async_once`

error[E0277]: the trait bound `{gen closure@a.rs:9:21: 9:23}: AsyncFnOnce()` is not satisfied
  --> a.rs:10:10
   |
10 |     pin!(call_async_once(f)).poll(&mut Context::from_waker(Waker::noop()));
   |          ^^^^^^^^^^^^^^^^^^ the trait `AsyncFnOnce()` is not implemented for `{gen closure@a.rs:9:21: 9:23}`
   |
note: required by a bound in `call_async_once`
  --> a.rs:5:34
   |
 5 | async fn call_async_once(f: impl AsyncFnOnce()) {
   |                                  ^^^^^^^^^^^^^ required by this bound in `call_async_once`

error[E0277]: the trait bound `{gen closure@a.rs:9:21: 9:23}: AsyncFnOnce()` is not satisfied
  --> a.rs:10:5
   |
10 |     pin!(call_async_once(f)).poll(&mut Context::from_waker(Waker::noop()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsyncFnOnce()` is not implemented for `{gen closure@a.rs:9:21: 9:23}`
   |
note: required by a bound in `call_async_once`
  --> a.rs:5:34
   |
 5 | async fn call_async_once(f: impl AsyncFnOnce()) {
   |                                  ^^^^^^^^^^^^^ required by this bound in `call_async_once`

error[E0277]: the trait bound `{gen closure@a.rs:9:21: 9:23}: AsyncFnOnce()` is not satisfied
  --> a.rs:10:5
   |
10 |     pin!(call_async_once(f)).poll(&mut Context::from_waker(Waker::noop()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsyncFnOnce()` is not implemented for `{gen closure@a.rs:9:21: 9:23}`
   |
note: required by a bound in `call_async_once`
  --> a.rs:5:34
   |
 5 | async fn call_async_once(f: impl AsyncFnOnce()) {
   |                                  ^^^^^^^^^^^^^ required by this bound in `call_async_once`

error[E0277]: the trait bound `{gen closure@a.rs:9:21: 9:23}: AsyncFnOnce()` is not satisfied
  --> a.rs:10:5
   |
10 |     pin!(call_async_once(f)).poll(&mut Context::from_waker(Waker::noop()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsyncFnOnce()` is not implemented for `{gen closure@a.rs:9:21: 9:23}`
   |
note: required by a bound in `call_async_once`
  --> a.rs:5:34
   |
 5 | async fn call_async_once(f: impl AsyncFnOnce()) {
   |                                  ^^^^^^^^^^^^^ required by this bound in `call_async_once`

error[E0277]: the trait bound `{gen closure@a.rs:9:21: 9:23}: AsyncFnOnce()` is not satisfied
  --> a.rs:10:5
   |
10 |     pin!(call_async_once(f)).poll(&mut Context::from_waker(Waker::noop()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsyncFnOnce()` is not implemented for `{gen closure@a.rs:9:21: 9:23}`
   |
note: required by a bound in `call_async_once`
  --> a.rs:5:34
   |
 5 | async fn call_async_once(f: impl AsyncFnOnce()) {
   |                                  ^^^^^^^^^^^^^ required by this bound in `call_async_once`

error[E0277]: the trait bound `{gen closure@a.rs:9:21: 9:23}: AsyncFnOnce()` is not satisfied
  --> a.rs:10:5
   |
10 |     pin!(call_async_once(f)).poll(&mut Context::from_waker(Waker::noop()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsyncFnOnce()` is not implemented for `{gen closure@a.rs:9:21: 9:23}`
   |
note: required by a bound in `call_async_once`
  --> a.rs:5:34
   |
 5 | async fn call_async_once(f: impl AsyncFnOnce()) {
   |                                  ^^^^^^^^^^^^^ required by this bound in `call_async_once`

error: aborting due to 7 previous errors

For more information about this error, try `rustc --explain E0277`.
Desired output
error[E0277]: the trait bound `{gen closure@a.rs:9:21: 9:23}: AsyncFnOnce()` is not satisfied
  --> a.rs:10:26
   |
10 |     pin!(call_async_once(f)).poll(&mut Context::from_waker(Waker::noop()));
   |          --------------- ^ the trait `AsyncFnOnce()` is not implemented for `{gen closure@a.rs:9:21: 9:23}`
   |          |
   |          required by a bound introduced by this call
   |
note: required by a bound in `call_async_once`
  --> a.rs:5:34
   |
 5 | async fn call_async_once(f: impl AsyncFnOnce()) {
   |                                  ^^^^^^^^^^^^^ required by this bound in `call_async_once`

error[E0277]: the trait bound `{gen closure@a.rs:9:21: 9:23}: AsyncFnOnce()` is not satisfied
  --> a.rs:10:10
   |
10 |     pin!(call_async_once(f)).poll(&mut Context::from_waker(Waker::noop()));
   |          ^^^^^^^^^^^^^^^^^^ the trait `AsyncFnOnce()` is not implemented for `{gen closure@a.rs:9:21: 9:23}`
   |
note: required by a bound in `call_async_once`
  --> a.rs:5:34
   |
 5 | async fn call_async_once(f: impl AsyncFnOnce()) {
   |                                  ^^^^^^^^^^^^^ required by this bound in `call_async_once`

error[E0277]: the trait bound `{gen closure@a.rs:9:21: 9:23}: AsyncFnOnce()` is not satisfied
  --> a.rs:10:5
   |
10 |     pin!(call_async_once(f)).poll(&mut Context::from_waker(Waker::noop()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsyncFnOnce()` is not implemented for `{gen closure@a.rs:9:21: 9:23}`
   |
note: required by a bound in `call_async_once`
  --> a.rs:5:34
   |
 5 | async fn call_async_once(f: impl AsyncFnOnce()) {
   |                                  ^^^^^^^^^^^^^ required by this bound in `call_async_once`

error: aborting due to 7 previous errors

For more information about this error, try `rustc --explain E0277`.
Rationale and extra context

No response

Other cases

Rust Version
rustc 1.97.0-nightly (67bcaa9c4 2026-05-01)
binary: rustc
commit-hash: 67bcaa9c4b1b1015efae3d591155c79760b1e0a5
commit-date: 2026-05-01
host: x86_64-unknown-linux-gnu
release: 1.97.0-nightly
LLVM version: 22.1.4
Anything else?

needs --edition=2024

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 running the provided a.rs reproducer with rustc 1.97.0-nightly and --edition=2024, then trace the compiler's diagnostic emission for the repeated E0277 messages. Done means the reproducer reports the same seven errors but displays only the three distinct diagnostics shown in the desired output.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.