Skip to content

macro_rules macros should not be serialized through strings in crate metadata. #49511

Closed
@eddyb

Description

@eddyb

macro_rules should use TokenStreams instead of being pretty-printed into a string and later re-parsed. This is required to get correct/precise hygiene information and original source spans.

For example, right now macros from libstd get <std macros> in their spans instead of the original source, and we hide printing any of that source because it looks much worse than the original, and those spans also don't capture any fine-grained information from macro-defining macros.

IIRC @ibabushkin started working on this (see #43847) but I couldn't find a tracking issue.
cc @alexcrichton @jseyfried @Manishearth

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions