Skip to content

equivalent of $crate in custom derive paths #507

@dhardy

Description

@dhardy

With declarative macros I can use $crate to specify fully-qualified paths in a way that works both in the parent crate and when exported to other crates. Is there an equivalent for procedural macros?

::mylib::MyType doesn't work within mylib. Before "edition 2018", a workaround like this would probably have been possible, but I don't believe it is any longer:

// in crate root:
mod mylib {
    pub use super::*;
}

Considering that these macros must currently be defined in another crate it is of course more complicated; a simple $crate would expand to the wrong thing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions