Skip to content

Newlines in deprecation warning are handled strangely - double newlines are stripped completely #149732

@orlp

Description

@orlp

Code

pub struct A;

impl A {
    #[deprecated(note =
"Foo some.
Bar sentence.")]
    /// Function 1.
    pub fn func1() {}

    #[deprecated(note =
"Foo some.

Bar sentence.")]
    /// Function 2.
    pub fn func2() {}
}

Reproduction Steps

cargo doc

Expected Outcome

I would expect single newlines to get replaced with a space, and double newlines to start a new paragraph, like in the rest of the documentation.

Actual Output

Single newlines are kept verbatim, double newlines are stripped entirely. Note the lack of a space between sentences in func2:

Image

Version

rustdoc 1.93.0-nightly (25d319a 2025-11-11)

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions