-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.Category: This is a bug.F-param_attrs`#![feature(param_attrs)]``#![feature(param_attrs)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Description
As this example repo
This is the example proc-macro:
extern crate proc_macro;
use proc_macro::TokenStream;
#[proc_macro_attribute]
pub fn rename_params(_args: TokenStream, input: TokenStream) -> TokenStream {
println!("{}", &input);
input
}
This is the test:
#![feature(param_attrs)]
use params_attribute_example::rename_params;
#[rename_params]
fn hello(a: i32, #[val] b: i32) {}
Run cargo expand --test rename-params
,both of println
result and expand
result are:
fn hello(a: i32, b: i32) {}
Formal parameter attributes disappear in proc-macro.
Toolchain: nightly-x86_64-apple-darwin(8a58268b5 2019-07-31)
Metadata
Metadata
Assignees
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.Category: This is a bug.F-param_attrs`#![feature(param_attrs)]``#![feature(param_attrs)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.