From 54bb4907840cb61233377cbdb1fcb6dbb8968eac Mon Sep 17 00:00:00 2001 From: Jieyou Xu Date: Wed, 30 Sep 2026 23:17:34 +0800 Subject: [PATCH 1/4] Revert "Route rustfmt repo backport nominations to zulip" This reverts commit b4260f44f5d8cd538718b9046eb51baaa1eb8f5e, reversing changes made to ec46636574fca6fce6014a143392f7d4a6d4d2ee. Since we can't actually do backports from rustfmt repo itself... --- src/tools/rustfmt/triagebot.toml | 51 -------------------------------- 1 file changed, 51 deletions(-) diff --git a/src/tools/rustfmt/triagebot.toml b/src/tools/rustfmt/triagebot.toml index d156d2b70ae58..de28ad00a4272 100644 --- a/src/tools/rustfmt/triagebot.toml +++ b/src/tools/rustfmt/triagebot.toml @@ -102,57 +102,6 @@ add_labels = ["S-waiting-on-review"] # Documentation at: [shortcut] -# ------------------------------------------------------------------------------ -# Backport nominations (rustfmt repo side) -# ------------------------------------------------------------------------------ - -[notify-zulip."beta-nominated".rustfmt] -zulip_stream = 621384 # #t-rustfmt/backports -topic = "rustfmt#{number}: beta-nominated" -message_on_add = [ - """\ -@*T-rustfmt* @*T-rustfmt-contributors* PR rustfmt#{number} "{title}" has been nominated -for beta backport. -""", - """\ -/poll Approve beta backport of rustfmt#{number}? -approve -decline -don't know -""", -] -message_on_remove = "PR rustfmt#{number}'s beta-nomination has been removed." - -[notify-zulip."beta-accepted".rustfmt] -zulip_stream = 621384 # #t-rustfmt/backports -# Put it in the same thread as beta-nominated. -topic = "rustfmt#{number}: beta-nominated" -message_on_add = "PR rustfmt#{number} has been **accepted** for **beta** backport." - -[notify-zulip."stable-nominated".rustfmt] -zulip_stream = 621384 # #t-rustfmt/backports -topic = "rustfmt#{number}: stable-nominated" -message_on_add = [ - """\ -@*T-rustfmt* @*T-rustfmt-contributors* PR rustfmt#{number} "{title}" has been nominated -for stable backport. -""", - """\ -/poll Approve stable backport of rustfmt#{number}? -approve -approve (but does not justify new dot release on its own) -decline -don't know -""", -] -message_on_remove = "PR rustfmt#{number}'s stable-nomination has been removed." - -[notify-zulip."stable-accepted".rustfmt] -zulip_stream = 621384 # #t-rustfmt/backports -# Put it in the same thread as stable-nominated. -topic = "rustfmt#{number}: stable-nominated" -message_on_add = "PR rustfmt#{number} has been **accepted** for **stable** backport." - # ------------------------------------------------------------------------------ # PR assignments # ------------------------------------------------------------------------------ From e8aa31c7ef7a37f9b9c490ce2e8cb584b3dd4b5a Mon Sep 17 00:00:00 2001 From: derekbailey Date: Thu, 1 Oct 2026 22:47:57 +0000 Subject: [PATCH 2/4] fix(items): format comments after where using clause_shape budget When formatting an item with a where clause, the budget before the where clause is throttled by the item header width. However, comments between the `where` keyword and the first predicate are indented on their own lines and should be formatted with the full clause budget (`clause_shape`) rather than the throttled budget. Pass `clause_shape` to `rewrite_comments_before_after_where` so that comments after `where` are not prematurely wrapped. Fixes rust-lang/rustfmt#7148. --- src/tools/rustfmt/src/items.rs | 20 ++++++------ .../where-clause-comment-wrap-issue-7148.rs | 29 +++++++++++++++++ .../where-clause-comment-wrap-issue-7148.rs | 31 +++++++++++++++++++ 3 files changed, 71 insertions(+), 9 deletions(-) create mode 100644 src/tools/rustfmt/tests/source/where-clause-comment-wrap-issue-7148.rs create mode 100644 src/tools/rustfmt/tests/target/where-clause-comment-wrap-issue-7148.rs diff --git a/src/tools/rustfmt/src/items.rs b/src/tools/rustfmt/src/items.rs index 60d8d8963c524..449cca87afe4a 100644 --- a/src/tools/rustfmt/src/items.rs +++ b/src/tools/rustfmt/src/items.rs @@ -3121,8 +3121,13 @@ fn rewrite_where_keyword( let (span_before, span_after) = missing_span_before_after_where(span_end_before_where, predicates, where_span); - let (comment_before, comment_after) = - rewrite_comments_before_after_where(context, span_before, span_after, shape)?; + let (comment_before, comment_after) = rewrite_comments_before_after_where( + context, + span_before, + span_after, + block_shape, + clause_shape, + )?; let starting_newline = match where_clause_option.snuggle { WhereClauseSpace::Space if comment_before.is_empty() => Cow::from(" "), @@ -3316,14 +3321,11 @@ fn rewrite_comments_before_after_where( context: &RewriteContext<'_>, span_before_where: Span, span_after_where: Span, - shape: Shape, + before_shape: Shape, + after_shape: Shape, ) -> Result<(String, String), RewriteError> { - let before_comment = rewrite_missing_comment(span_before_where, shape, context)?; - let after_comment = rewrite_missing_comment( - span_after_where, - shape.block_indent(context.config.tab_spaces()), - context, - )?; + let before_comment = rewrite_missing_comment(span_before_where, before_shape, context)?; + let after_comment = rewrite_missing_comment(span_after_where, after_shape, context)?; Ok((before_comment, after_comment)) } diff --git a/src/tools/rustfmt/tests/source/where-clause-comment-wrap-issue-7148.rs b/src/tools/rustfmt/tests/source/where-clause-comment-wrap-issue-7148.rs new file mode 100644 index 0000000000000..ba6b3966f6c2c --- /dev/null +++ b/src/tools/rustfmt/tests/source/where-clause-comment-wrap-issue-7148.rs @@ -0,0 +1,29 @@ +// rustfmt-wrap_comments: true +// rustfmt-max_width: 100 +// rustfmt-comment_width: 100 + +// Comments between `where` and the first predicate should be formatted using +// the full column budget rather than a budget derived from the header width. +impl SomeTrait for LongTypeName +where + // A long comment line between where and the first clause that fits within max width limit + // already. So no additional wrapping should occur. + T: SomeTrait, + + // A long comment line between where and the first clause that fits within max width limit + // already. So no additional wrapping should occur. + T: OtherTrait, +{ +} + +// Comments between `where` and the first predicate should be formatted using +// the full column budget rather than a budget derived from the header width. +impl SomeOtherTrait for LongTypeName +where + // A long comment line between where and the first clause that doesn't fit within max width limit already. So additional wrapping should occur. + T: SomeTrait, + + // A long comment line between where and the first clause that doesn't fit within max width limit already. So additional wrapping should occur. + T: OtherTrait, +{ +} diff --git a/src/tools/rustfmt/tests/target/where-clause-comment-wrap-issue-7148.rs b/src/tools/rustfmt/tests/target/where-clause-comment-wrap-issue-7148.rs new file mode 100644 index 0000000000000..08f3d3e43123c --- /dev/null +++ b/src/tools/rustfmt/tests/target/where-clause-comment-wrap-issue-7148.rs @@ -0,0 +1,31 @@ +// rustfmt-wrap_comments: true +// rustfmt-max_width: 100 +// rustfmt-comment_width: 100 + +// Comments between `where` and the first predicate should be formatted using +// the full column budget rather than a budget derived from the header width. +impl SomeTrait for LongTypeName +where + // A long comment line between where and the first clause that fits within max width limit + // already. So no additional wrapping should occur. + T: SomeTrait, + + // A long comment line between where and the first clause that fits within max width limit + // already. So no additional wrapping should occur. + T: OtherTrait, +{ +} + +// Comments between `where` and the first predicate should be formatted using +// the full column budget rather than a budget derived from the header width. +impl SomeOtherTrait for LongTypeName +where + // A long comment line between where and the first clause that doesn't fit within max width + // limit already. So additional wrapping should occur. + T: SomeTrait, + + // A long comment line between where and the first clause that doesn't fit within max width + // limit already. So additional wrapping should occur. + T: OtherTrait, +{ +} From ca52f5285d2dc13df40190aa2af728d15479d162 Mon Sep 17 00:00:00 2001 From: Jieyou Xu Date: Mon, 5 Oct 2026 19:38:40 +0800 Subject: [PATCH 3/4] ci: bump `actions/checkout` to v7.0.1 --- src/tools/rustfmt/.github/workflows/check_diff.yml | 2 +- src/tools/rustfmt/.github/workflows/clippy.yml | 4 ++-- src/tools/rustfmt/.github/workflows/integration.yml | 2 +- src/tools/rustfmt/.github/workflows/rustdoc_check.yml | 2 +- src/tools/rustfmt/.github/workflows/test.yml | 2 +- src/tools/rustfmt/.github/workflows/upload-assets.yml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/tools/rustfmt/.github/workflows/check_diff.yml b/src/tools/rustfmt/.github/workflows/check_diff.yml index 90944500a44b0..b3543a49c3e9b 100644 --- a/src/tools/rustfmt/.github/workflows/check_diff.yml +++ b/src/tools/rustfmt/.github/workflows/check_diff.yml @@ -50,7 +50,7 @@ jobs: steps: - name: checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Build check_diff binary working-directory: ./check_diff diff --git a/src/tools/rustfmt/.github/workflows/clippy.yml b/src/tools/rustfmt/.github/workflows/clippy.yml index 92e385d135c0e..a5aa91346dd84 100644 --- a/src/tools/rustfmt/.github/workflows/clippy.yml +++ b/src/tools/rustfmt/.github/workflows/clippy.yml @@ -12,7 +12,7 @@ jobs: name: check clippy configs steps: - name: checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: install rustup run: | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup-init.sh @@ -34,7 +34,7 @@ jobs: - config_proc_macro steps: - name: checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: install rustup run: | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup-init.sh diff --git a/src/tools/rustfmt/.github/workflows/integration.yml b/src/tools/rustfmt/.github/workflows/integration.yml index 09fc59114e97e..224605740e55e 100644 --- a/src/tools/rustfmt/.github/workflows/integration.yml +++ b/src/tools/rustfmt/.github/workflows/integration.yml @@ -59,7 +59,7 @@ jobs: steps: - name: checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 # Run build - name: install rustup diff --git a/src/tools/rustfmt/.github/workflows/rustdoc_check.yml b/src/tools/rustfmt/.github/workflows/rustdoc_check.yml index 04bb8e1d240f6..b3978005fdf62 100644 --- a/src/tools/rustfmt/.github/workflows/rustdoc_check.yml +++ b/src/tools/rustfmt/.github/workflows/rustdoc_check.yml @@ -12,7 +12,7 @@ jobs: name: rustdoc check steps: - name: checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: install rustup run: | diff --git a/src/tools/rustfmt/.github/workflows/test.yml b/src/tools/rustfmt/.github/workflows/test.yml index aed79eb2e7b72..6d0f25834e596 100644 --- a/src/tools/rustfmt/.github/workflows/test.yml +++ b/src/tools/rustfmt/.github/workflows/test.yml @@ -42,7 +42,7 @@ jobs: if: ${{ matrix.os == 'windows-latest' }} run: git config --global core.autocrlf false - name: checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Install Rustup using win.rustup.rs if: ${{ matrix.os == 'windows-latest' }} diff --git a/src/tools/rustfmt/.github/workflows/upload-assets.yml b/src/tools/rustfmt/.github/workflows/upload-assets.yml index a6a3d3bc51a85..991cc965e3d51 100644 --- a/src/tools/rustfmt/.github/workflows/upload-assets.yml +++ b/src/tools/rustfmt/.github/workflows/upload-assets.yml @@ -31,7 +31,7 @@ jobs: target: x86_64-pc-windows-msvc runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 # Run build - name: install rustup From 2bc67f44dc804ab75a17a13eee7ecd8a1336bab1 Mon Sep 17 00:00:00 2001 From: Yacin Tmimi Date: Mon, 5 Oct 2026 12:40:51 -0400 Subject: [PATCH 4/4] Prepare for merging from rust-lang/rust This updates the rust-toolchain.toml file to nightly-2026-10-05 (28221559263a3976766cf305940e80e30cf9ba8a). --- src/tools/rustfmt/rust-toolchain.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/rustfmt/rust-toolchain.toml b/src/tools/rustfmt/rust-toolchain.toml index 0d01929160891..05c048743fe34 100644 --- a/src/tools/rustfmt/rust-toolchain.toml +++ b/src/tools/rustfmt/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2026-09-23" +channel = "nightly-2026-10-05" components = ["llvm-tools", "rustc-dev"]