Closed
Description
Use deprecated
attribute on a procedural macro function doesn't work like expected: it triggers a warning message also when library is building and not just in call place.
I know that the deprecate
attribute support is not landed in stable but this warning is present in all channels (stable, beta and nightly).
stable-x86_64-unknown-linux-gnu unchanged - rustc 1.38.0 (625451e37 2019-09-23)
beta-x86_64-unknown-linux-gnu unchanged - rustc 1.39.0-beta.5 (fa5c2f3e5 2019-10-02)
nightly-x86_64-unknown-linux-gnu updated - rustc 1.40.0-nightly (421bd77f4 2019-10-06)
Compiling lib simple by cargo +beta build
raise follow warning:
Compiling deprecete_proc_macro v0.1.0 (/home/michele/temp/ppp/deprecete_proc_macro)
warning: use of deprecated item 'deprecable_fn'
--> src/lib.rs:6:1
|
6 | pub fn deprecable_fn(input: proc_macro::TokenStream) -> proc_macro::TokenStream { input }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(deprecated)]` on by default
warning: use of deprecated item 'deprecable_derive'
--> src/lib.rs:10:1
|
10 | pub fn deprecable_derive(input: proc_macro::TokenStream) -> proc_macro::TokenStream { input }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: use of deprecated item 'deprecable_attr'
--> src/lib.rs:14:1
|
14 | pub fn deprecable_attr(_args: proc_macro::TokenStream, input: proc_macro::TokenStream) -> proc_macro::TokenStream { input }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Finished dev [unoptimized + debuginfo] target(s) in 0.70s
Sadly this issue make deprecated
attribute not usable at all for procedural macro.
Follow the code to reproduce this issue:
Cargo.toml
[package]
name = "deprecete_proc_macro"
version = "0.1.0"
authors = ["me <myself@gmail.com>"]
edition = "2018"
[lib]
proc_macro=true
src/lib.rs
extern crate proc_macro;
#[deprecated]
#[proc_macro]
pub fn deprecable_fn(input: proc_macro::TokenStream) -> proc_macro::TokenStream { input }
#[deprecated]
#[proc_macro_derive(Deprecable)]
pub fn deprecable_derive(input: proc_macro::TokenStream) -> proc_macro::TokenStream { input }
#[deprecated]
#[proc_macro_attribute]
pub fn deprecable_attr(_args: proc_macro::TokenStream, input: proc_macro::TokenStream) -> proc_macro::TokenStream { input }
This issue has been assigned to @XiangQingW via this comment.
Metadata
Metadata
Assignees
Labels
Area: Lints (warnings about flaws in source code) such as unused_mut.Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Category: This is a bug.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Relevant to the compiler team, which will review and decide on the PR/issue.