Skip to content

async blocks in a const-context error on nightly, but not on stable #77361

Closed
@DutchGhost

Description

@DutchGhost

The following code compiles on stable, but not on nightly. I know this is realy bogus code, and I'm not sure it should be rejected:

fn regress() -> [(); { core::mem::ManuallyDrop::new(async { 0 }); 4 }] {
    todo!()
}

On nightly, the error message is:

error: `from_generator` is not yet stable as a const fn
 --> src/lib.rs:2:60
  |
2 | fn regress() -> [(); { core::mem::ManuallyDrop::new(async { 0 }); 4 }] {
  |                                                            ^^^^^^^^^
  |
  = help: add `#![feature(gen_future)]` to the crate attributes to enable

error: aborting due to previous error

error: could not compile `playground`

To learn more, run the command again with --verbose.

Metadata

Metadata

Labels

A-async-awaitArea: Async & AwaitA-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)A-stabilityArea: `#[stable]`, `#[unstable]` etc.AsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.P-mediumMedium priorityrequires-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