rust-lang / rust-lang/rustfmt

Block doc comment without continuing asterisk (`*`) doesn't align asterisk in starter/closer

Open
#7,109 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-doc-comments C-discussion
Dominant language
Rust
Stars
7k
Forks
1.1k
Avg merge
2d 13h
Merged PRs (30d)
24

Description

Summary

I tried to format this code:

https://github.com/rust-lang/rustfmt/blob/2d897e21c73042bbea04640fe21077660367e29f/tests/target/6639-non-idempotent-block-doc-comments/outer-block-doc-comment.rs#L5-L7

Expected behavior

I expected to see this happen:

I'm unsure about ideal formatting, but maybe the asterisk (*) of the block doc comment starter/closer should align? Maybe

/**
foo
 */
mod foo;

Rationale is that in fixing a related non-idempotent closer rewrite (https://github.com/rust-lang/rustfmt/pull/7017), the fix changes block doc formatting to align the starter/closer by asterisk when there is a continuing (*):

/**
 * foo
 */
mod foo;

This matches block doc comment formatting I've seen in other languages (e.g. javadoc). See discussion.

Actual behavior

Instead, this happened: no formatting changes; this is the stable formatting.

Configuration

rustfmt cli options used (if applicable): none needed

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

Reproduction Steps

Just plain rustfmt will do.

Meta

rustfmt --version:

rustfmt 1.9.0-stable (48a229ceae 2026-09-01)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tests/target/6639-non-idempotent-block-doc-comments/outer-block-doc-comment.rs and run plain rustfmt to reproduce the current stable output. Review the related rustfmt PR 7017 discussion for context, then confirm the intended starter/closer alignment for a block doc comment without continuing asterisks; done means the behavior is formatted consistently and remains stable on repeated runs.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.