Skip to content

Macros should have an operator type #8853

Closed
@darkf

Description

@darkf

AFAIK there is currently no way to quote an operator such as + or /, and this would be useful to reduce code duplication.

Something like:

macro_rules! foo(
    ($oper:op) => 10i $oper 20i
)

fn main() {
    printfln!("%d", foo!(+));
    printfln!("%d", foo!(*));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-syntaxextArea: Syntax extensionsC-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions