Skip to content

rustdoc: Regression in whitespacing inside macro_rules matchers #92331

Closed
@dtolnay

Description

@dtolnay
#[macro_export]
macro_rules! repro {
    ($e:expr, std::path) => {};
}

Before:

This preserves the spacing in the way that the macro author wrote, and exactly the way that they intend for the macro user to write those spaces on their end.

Screenshot from 2021-12-27 13-13-25

After:

The person calling the macro needs to reverse engineer where to add/delete spaces in order to get a readable result.

Screenshot from 2021-12-27 13-13-46

I haven't bisected but it seems likely from skimming the implementation that this is related to #86282. Overall I think #86282 would tend to be net negative for the vast majority of macros. @camelid @jyn514 is there perhaps some other way to deal with the edge cases that didn't have proper source code for rustdoc to copy?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.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