Skip to content

Add a support for immovable generators #2397

Closed
@topecongiro

Description

@topecongiro

For example, when I try to format the following code,

#![feature(generators)]

unsafe fn foo() {
    let mut g = static || {
        yield 3;
    };
}

rustfmt 0.3.6-nightly emits the following error:

error: expected expression, found keyword `static`
 --> test.rs:4:17
  |
4 |     let mut g = static || {
  |                 ^^^^^^

The procedure to fix this would be something like this:

  1. add tests to make sure that rustfmt handles immovable generators
  2. update rustc-ap-syntax and rustc-ap-rustc_errors to the latest version
  3. update expr.rs and closures.rs to support immovable generators

cc rust-lang/rust#45337

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugPanic, non-idempotency, invalid code, etc.good first issueIssues up for grabs, also good candidates for new rustfmt contributors

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions