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

Abierto
#7,232 0 comentarios 1 reacción 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
68/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
rust
Área
tooling

Línea de trabajo

The reproducer is already in a tests/source file, though the payload does not name its path. Read the existing inline link wrapping cases and the comment wrapping logic for lists and block quotes, then run the relevant rustfmt test with wrap_comments=true. Done means these inline links remain unbroken across the listed contexts while the existing formatting tests still pass.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

A-doc-comments A-intra-doc-links A-markdown C-bug UO-wrap_comments

Summary

More specific case of https://github.com/rust-lang/rustfmt/issues/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 https://github.com/rust-lang/rustfmt/pull/7197 (I was reviewing it and noticed this.)

Lenguaje dominante
Rust
Estrellas
7.1k
Forks
1.2k
Merge medio
1 d 4 h
PR fusionados (30 d)
20

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de rust-lang/rustfmt

Todos los issues de rust-lang/rustfmt

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.