Skip to content

Allow macros to be used in literals and/or meta items #1516

@erickt

Description

@erickt

In this reddit comment Perceptes mentioned one idea to cut down down on some of the syntex boilerplate would be to use the #[path = ...] attribute to point to one of the generated files, as in this:

#[path = concat!(env!("OUT_DIR"), "/generated_foo.rs")]
mod foo;

Unfortunately this is currently illegal, because macros cannot be used in the position of a literal. It would be nice if we supported this functionality.

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-langRelevant to the language team, which will review and decide on the RFC.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions