Closed
Description
I have been able to reproduce #64282.
If an fn
inside an impl
has a param attr on the first parameter, no matter how many, they are not visible in the TokenStream
.
Repro repo: https://github.com/bbqsrc/params-attribute-example
Source:
#[rename_params(send_help)]
fn hello(#[angery(true)] a: i32, #[a2] b: i32, #[what = "how"] c: u32) {}
#[rename_params(send_help)]
impl Foo {
fn hello(#[angery(true)] a: i32, #[a2] b: i32, #[what = "how"] c: u32) {}
fn hello2(#[a1] #[a2] a: i32, #[what = "how"] b: i32, #[angery(true)] c: u32) {}
fn hello_self(#[a1] #[a2] &self, #[a1] #[a2] a: i32, #[what = "how"] b: i32, #[angery(true)] c: u32) {}
}
Printed output:
fn hello(#[angery(true)] a: i32, #[a2] b: i32, #[what = "how"] c: u32) { }
impl Foo {
fn hello(a: i32, #[a2] b: i32, #[what = "how"] c: u32) { }
fn hello2(a: i32, #[what = "how"] b: i32, #[angery(true)] c: u32) { }
fn hello_self(#[a1] #[a2] &self, #[a1] #[a2] a: i32,
#[what = "how"] b: i32, #[angery(true)] c: u32) {
}
}
As you can see, hello
and hello2
are missing their attrs on the a
param. The addition of self
however gives both self
and the a
param their attrs. Weird.
$ rustc --version
rustc 1.39.0-nightly (ed8b708c1 2019-09-21)