-
Notifications
You must be signed in to change notification settings - Fork 996
Open
Labels
A-2024-style-editionArea: style edition 2024Area: style edition 2024A-commentsArea: commentsArea: commentsC-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICECategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEI-invalid-codeIssue: formatting causes compile-pass code to compile-failIssue: formatting causes compile-pass code to compile-failS-has-mcveStatus: a Minimal Complete and Verifiable Example has been found for this issueStatus: a Minimal Complete and Verifiable Example has been found for this issue
Description
Summary
I tried to format this code:
pub async fn foo(
// OriginalUri(original_uri): OriginalUri,
) -> Option<Option<Option<Option<String>>>> {
None
}Expected behavior
I expected the code to continue to successfully compile after rustfmt.
Actual behavior
It gets reformatted to:
pub async fn foo(// OriginalUri(original_uri): OriginalUri,)
-> Option<Option<Option<Option<String>>>> {
None
}where the closing ) ends up being commented out.
This only happens if both the comment and the return type are sufficiently long/complex.
Configuration
$ rustfmt +nightly --edition 2024 src/lib.rsMeta
rustfmt --version:
rustfmt 1.9.0-nightly (0c68443b0a 2026-03-10)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-2024-style-editionArea: style edition 2024Area: style edition 2024A-commentsArea: commentsArea: commentsC-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICECategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEI-invalid-codeIssue: formatting causes compile-pass code to compile-failIssue: formatting causes compile-pass code to compile-failS-has-mcveStatus: a Minimal Complete and Verifiable Example has been found for this issueStatus: a Minimal Complete and Verifiable Example has been found for this issue