Skip to content
2 changes: 1 addition & 1 deletion src/tools/rustfmt/.github/workflows/check_diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/tools/rustfmt/.github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rustfmt/.github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rustfmt/.github/workflows/rustdoc_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rustfmt/.github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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' }}
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rustfmt/.github/workflows/upload-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rustfmt/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2026-09-23"
channel = "nightly-2026-10-05"
components = ["llvm-tools", "rustc-dev"]
20 changes: 11 additions & 9 deletions src/tools/rustfmt/src/items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(" "),
Expand Down Expand Up @@ -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))
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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<T> SomeTrait for LongTypeName<T>
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<T> SomeOtherTrait for LongTypeName<T>
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,
{
}
Original file line number Diff line number Diff line change
@@ -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<T> SomeTrait for LongTypeName<T>
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<T> SomeOtherTrait for LongTypeName<T>
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,
{
}
51 changes: 0 additions & 51 deletions src/tools/rustfmt/triagebot.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,57 +102,6 @@ add_labels = ["S-waiting-on-review"]
# Documentation at: <https://forge.rust-lang.org/triagebot/shortcuts.html>
[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
# ------------------------------------------------------------------------------
Expand Down
Loading