Skip to content

proc_macro_derive(attributes(path::to)) both does and doesn't work #55168

Closed
@CAD97

Description

@CAD97
// crate `derive`
// lib.proc-macro = true
#[proc_macro_derive(WellThen, attributes(well::then))]
pub fn derive(i: ::proc_macro::TokenStream) -> ::proc_macro::TokenStream {
    i
}

// crate `user`
use derive::WellThen;
#[derive(WellThen)]
#[well::then]
struct A;
error[E0433]: failed to resolve. Use of undeclared type or module `well`
  --> user\main.rs:3:3
   |
 3 | #[well::then]
   |   ^^^^ Use of undeclared type or module `well`

I would expect either for this to work or for #[proc_macro_derive(attributes(..))] to reject a path and only accept an ident, as specifying a path here doesn't work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-attributesArea: Attributes (`#[…]`, `#![…]`)A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions