pub static AMBIGUOUS_DERIVE_HELPERS: &'static LintExpand description
The ambiguous_derive_helpers lint detects cases where a derive macro’s helper attribute
is the same name as that of a built-in attribute.
§Example
ⓘ
#![crate_type = "proc-macro"]
#![deny(ambiguous_derive_helpers)]
use proc_macro::TokenStream;
#[proc_macro_derive(Trait, attributes(ignore))]
pub fn example(input: TokenStream) -> TokenStream {
TokenStream::new()
}Produces:
warning: there exists a built-in attribute with the same name
--> file.rs:5:39
|
5 | #[proc_macro_derive(Trait, attributes(ignore))]
| ^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #151152 <https://github.com/rust-lang/rust/issues/151152>
= note: `#[deny(ambiguous_derive_helpers)]` (part of `#[deny(future_incompatible)]`) on by default§Explanation
Attempting to use this helper attribute will throw an error:
ⓘ
#[derive(Trait)]
struct Example {
#[ignore]
fields: ()
}Produces:
error[E0659]: `ignore` is ambiguous
--> src/lib.rs:5:7
|
5 | #[ignore]
| ^^^^^^ ambiguous name
|
= note: ambiguous because of a name conflict with a builtin attribute
= note: `ignore` could refer to a built-in attribute
note: `ignore` could also refer to the derive helper attribute defined here
--> src/lib.rs:3:10
|
3 | #[derive(Trait)]
| ^^^^^