Skip to content

"functions cannot be both _ and _" diagnostic thinks gen fns are async #130232

Closed
@PatchMixolydic

Description

@PatchMixolydic

Code

(playground)

#![feature(gen_blocks)]

const gen fn x() {}

Current output

error: functions cannot be both `const` and `async`
 --> src/lib.rs:3:1
  |
3 | const gen fn x() {}
  | ^^^^^-^^^----------
  | |     |
  | |     `async` because of this
  | `const` because of this

Desired output

error: functions cannot be both `const` and `gen`
 --> src/lib.rs:3:1
  |
3 | const gen fn x() {}
  | ^^^^^-^^^----------
  | |     |
  | |     `gen` because of this
  | `const` because of this

Rust Version

rustc 1.80.0 (051478957 2024-07-21)
binary: rustc
commit-hash: 051478957371ee0084a7c0913941d2a8c4757bb9
commit-date: 2024-07-21
host: x86_64-unknown-linux-gnu
release: 1.80.0
LLVM version: 18.1.7

Reproduces on the playground using 1.83.0-nightly (2024-09-05 9c01301c52df5d2d7b6f).

Anything else?

@rustbot label +D-incorrect +F-gen_blocks +requires-nightly

Metadata

Metadata

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsD-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.F-gen_blocks`gen {}` expressions that produce `Iterator`sT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions