Skip to content

Async fn loses mut pattern when passed to attribute macro #60674

Closed
@dtolnay

Description

@dtolnay

Cargo.toml

[package]
name = "repro"
version = "0.0.0"
edition = "2018"

[lib]
proc-macro = true

src/lib.rs

extern crate proc_macro;
use proc_macro::TokenStream;

#[proc_macro_attribute]
pub fn attr(_args: TokenStream, input: TokenStream) -> TokenStream {
    println!("{}", input);
    TokenStream::new()
}

src/main.rs

#[repro::attr]
async fn f(mut x: u8) {}

fn main() {}

Between nightly-2019-05-07 and nightly-2019-05-08, the mut pattern that should be part of the macro input went missing. a19cf18...cfdc84a

$ cargo +nightly-2019-05-07 check
   Compiling repro v0.0.0
async fn f(mut x: u8) { }

$ cargo +nightly-2019-05-08 check
   Compiling repro v0.0.0
async fn f(x: u8) { }

Originally reported by @kjvalencik in dtolnay/syn#632.
Mentioning @taiki-e @cramertj @davidtwco because #60535 looks relevant and is in the right commit range.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-async-awaitArea: Async & AwaitA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)AsyncAwait-PolishAsync-await issues that are part of the "polish" areaC-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions