Skip to content

wrap_comments=true breaks inside inline links breaking it (part 2; inside lists and block quotes) #7232

Open

Description

@jieyouxu

Summary

More specific case of #7177, for inline links inside lists and blockquotes.

I tried to format this code:

//@ rustfmt-wrap_comments: true

pub mod lists_and_block_quotes {
    /// - [`queue_user_requested_email_otp`](fn@super::queue_user_requested_email_otp), over the channel.
    pub fn a() {}

    /// * [`queue_user_requested_email_otp`](struct@super::QueueUserRequestedEmailOtp), over the channel.
    pub fn b() {}

    /// 1. [`queue_user_requested_email_otp`](super::queue_user_requested_email_otp_abc), over the channel.
    pub fn c() {}

    /// > [`queue_user_requested_email_otp`](some/path/queue_user_requested_email_otp.html), over it.
    pub fn d() {}
}

Expected behavior

I expected to see this happen: no breaking inside inline links

Actual behavior

Instead, this happened: breaking on rustdoc disambiguators and relative paths

Diff in $dev/foo.rs:1:
 pub mod lists_and_block_quotes {
-    /// - [`queue_user_requested_email_otp`](fn@super::queue_user_requested_email_otp), over the channel.
+    /// - [`queue_user_requested_email_otp`](fn@
+    ///   super::queue_user_requested_email_otp), over the channel.
     pub fn a() {}

-    /// * [`queue_user_requested_email_otp`](struct@super::QueueUserRequestedEmailOtp), over the channel.
+    /// * [`queue_user_requested_email_otp`](struct@
+    ///   super::QueueUserRequestedEmailOtp), over the channel.
     pub fn b() {}

     /// 1. [`queue_user_requested_email_otp`](super::queue_user_requested_email_otp_abc), over the channel.
Diff in /Users/joe.xu/Documents/repos/repro/foo.rs:9:
     pub fn c() {}

-    /// > [`queue_user_requested_email_otp`](some/path/queue_user_requested_email_otp.html), over it.
+    /// > [`queue_user_requested_email_otp`](some/path/
+    /// > queue_user_requested_email_otp.html), over it.
     pub fn d() {}
 }

Configuration

rustfmt cli options used (if applicable):

$ rustfmt +nightly foo.rs --check --config-path=/dev/null --config=wrap_comments=true

rustfmt configuration file (e.g. rustfmt.toml, if applicable): N/A

Reproduction Steps

Already a tests/source file.

Meta

rustfmt --version: rustfmt 1.12.0-nightly (2d20b42b88 2026-11-04)

Not fixed by #7197 (I was reviewing it and noticed this.)

Activity

  1. added
    C-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICE
    on Nov 5, 2026
  2. added
    needs-triageThis issue or PR needs triaging to determine its status. Remove label once sufficiently triaged.
    on Nov 5, 2026
  3. added
    A-markdownArea: markdown formatting in doc comments
    A-doc-commentsArea: doc comments `/** */`, `#[doc = "..."]`, `///` and `//!`.
    A-intra-doc-linksArea: Intra-doc links, the ability to link to items in docs by name
    and removed
    needs-triageThis issue or PR needs triaging to determine its status. Remove label once sufficiently triaged.
    on Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-doc-commentsArea: doc comments `/** */`, `#[doc = "..."]`, `///` and `//!`.A-intra-doc-linksArea: Intra-doc links, the ability to link to items in docs by nameA-markdownArea: markdown formatting in doc commentsC-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEUO-wrap_commentsUnstable option: wrap_comments

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions