Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
yaahc opened this issue Apr 7, 2021 · 5 comments
Closed

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

yaahc opened this issue Apr 7, 2021 · 5 comments
Labels
A-proc-macros Area: Procedural macros regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Milestone

Comments

@yaahc
Copy link
Member

yaahc commented Apr 7, 2021

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

@rustbot rustbot added regression-from-stable-to-stable Performance or correctness regression from one stable version to another. I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Apr 7, 2021
@Mark-Simulacrum Mark-Simulacrum modified the milestones: 1.46, 1.47.0 Apr 7, 2021
@jyn514 jyn514 added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Apr 7, 2021
@jyn514
Copy link
Member

jyn514 commented Apr 7, 2021

Hmm, so it turns out this is specific to proc-macros, it shows up fine in the docs:
image
So I don't think this is actually related to rustdoc.

cc @Aaron1011 @petrochenkov does this change look familiar?

@jyn514 jyn514 added A-proc-macros Area: Procedural macros T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Apr 7, 2021
@yaahc yaahc changed the title rustdoc breaking change on stable: handling of block doc comments breaking change on stable: handling of block doc comments Apr 7, 2021
@ehuss
Copy link
Contributor

ehuss commented Apr 7, 2021

I believe this was changed as part of #74627.

EDIT: And I believe this is a duplicate of #80545.

@camelid
Copy link
Member

camelid commented Apr 8, 2021

FWIW, #80545 was prioritized as P-medium.

@camelid
Copy link
Member

camelid commented Apr 8, 2021

Hmm, no WG-prioritization stream was created for this issue. I'll try re-applying the label.

@camelid camelid added I-prioritize Issue: Indicates that prioritization has been requested for this issue. and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Apr 8, 2021
@jyn514
Copy link
Member

jyn514 commented Apr 8, 2021

Closing as a duplicate of #80545.

@jyn514 jyn514 closed this as completed Apr 8, 2021
@camelid camelid removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-proc-macros Area: Procedural macros regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants