Skip to content

breaking change on stable: handling of block doc comments #83982

Closed
@yaahc

Description

@yaahc

This issue was discovered in this PR on displaydoc yaahc/displaydoc#22 (comment) and previously reported in this zulip thread https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/block.20doc.20comments.20broken.3F.

To summarize the issue, previously if you had a multiple line block doc comment that had asterisks on the start of each line the asterisks were stripped by rustc prior to them being passed into proc macros. After the change the asterisks are left in and must be removed by the author of a proc macro.

Code

Based on this PR where we worked around the issue:

I tried this code in a proc macro:

    /**
     * line 1
     *
     * line 2
     */
    struct Foo;

I expected to see as the content of the #[doc] attribute:

"line 1\n\n line2"

Instead, I see this as the content of the attribute:

"* line 1\n *\n * line 2"

note: github isn't displaying this well but this includes all leading white space as well, so a newline, five spaces, then an astrisk, repeat.

Version it worked on

It most recently worked on: 1.46

Version with regression

rustc --version --verbose:

rustc 1.47.0 (18bf6b4f0 2020-10-07)
binary: rustc
commit-hash: 18bf6b4f01a6feaf7259ba7cdae58031af1b7b39
commit-date: 2020-10-07
host: x86_64-unknown-linux-gnu
release: 1.47.0
LLVM version: 11.0

@rustbot modify labels: +regression-from-stable-to-stable -regression-untriaged

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-proc-macrosArea: Procedural macrosT-compilerRelevant to the compiler 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

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions