Repository: rust-lang/rust
File: compiler/rustc_lint_defs/src/builtin.rs (Rust)

Code before:
    /// ```rust,ignore (needs-dependency)
    /// #[derive(Trait)]
    /// struct Example {
    ///     #[ignore]
    ///     fields: ()
    /// }
    /// ```
    ///
    /// Produces:
    ///
    /// ```text
    /// 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)]
    ///   |          ^^^^^
    /// ```
    pub DERIVE_HELPER_CLASHES_WITH_BUILTIN_ATTR,
    Warn,
    "same as a built-in attribute",
    @future_incompatible = FutureIncompatibleInfo {
        reason: fcw!(FutureReleaseError #151276),
    };
}

declare_lint! {
    /// The `private_interfaces` lint detects types in a primary interface of an item,
    /// that are more private than the item itself. Primary interface of an item is all
    /// its interface except for bounds on generic parameters and where clauses.
    ///
    /// ### Example
    ///
    /// ```rust,compile_fail
    /// # #![allow(unused)]
    /// #![deny(private_interfaces)]
    /// struct SemiPriv;
    ///
    /// mod m1 {
    ///     struct Priv;
    ///     impl crate::SemiPriv {
    ///         pub fn f(_: Priv) {}
    ///     }
    /// }

Review comment (refactor):
```suggestion
    pub AMBIGUOUS_DERIVE_HELPERS,
```

Inspired by @Darksonn's [suggestion](https://github.com/rust-lang/rust/pull/151152#issuecomment-3783661750) (thanks for that), perhaps `ambiguous-derive-helpers` would work.

Calling this "ambiguous" does seem right, given the purpose and the use-site error.  Beyond that, it should be named in the plural (given our conventions), and the name here aligns with an existing deny-by-default lint `legacy-derive-helpers` (that's a use-site lint; this is def-site -- but that seems OK).


Code after:
    /// ```rust,ignore (proc-macro)
    /// #![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:
    ///
    /// ```text
    /// 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:
    ///
    /// ```rust,ignore (needs-dependency)
    /// #[derive(Trait)]
    /// struct Example {
    ///     #[ignore]
    ///     fields: ()
    /// }
    /// ```
    ///
    /// Produces:
    ///
    /// ```text
    /// 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