Repository navigation
rustfmt subtree update 2026-11-18 - #166138
Conversation
The `matrix.channel` var is never set since <rust-lang/rustfmt#4703> or commit `26fb3fa737816532c17559552fb5ad0cbeeb610a` since 2021.
Remove dead mingw PATH steps in `test` CI workflow
That is, something like
$ printf "--config path/to/config.toml\n--check\n" > @args-file
$ rustfmt @args-file path/to/format.rs
# same as: rustfmt --config path/to/config.toml --check path/to/format.rs
The motivation for this is that `cargo fmt` collects the list of files
to be formatted and passes them to `rustfmt` as arguments. But this list
can get so long that it reaches OS limits, see rust-lang/rustfmt#6934.
The process for making this change was:
1. Go and look for inspiration from other tools
2. Find out the `rustdoc` supports this pattern[1] so just re-use its
approach[2]
Conveniently, that approach uses helpers from internal compiler crates
that are also available to us. Note, those helpers expect UTF-8
everywhere, which is what the current code also does, but this will be
an additional place to consider in the future if we want to move away
from that (see rustfmt/issues#7210).
Link: https://doc.rust-lang.org/rustdoc/command-line-arguments.html#path-load-command-line-flags-from-a-path [1]
Link: https://github.com/rust-lang/rust/blob/ab019e71a1a1f4688bcc4d5bf06d2c5a424a31a5/src/librustdoc/lib.rs#L827 [2]
Allow reading args from `@path`
That issue was about
````rust
/// ```
/// println!("1"); // comment
/// # println!("2")
/// ```
````
becoming
````rust
/// ```
/// println!("1"); // comment
///
/// # println!("2")
/// ```
````
under UO `format_code_in_doc_comments=true`.
Co-authored-by: Jieyou Xu <jieyouxu@outlook.com>
This errored with leftover trailing whitespace previously on SE 2024.
Fixes 5391 and 6612 Previously, leading whitespace at the start of custom comments (`CommentStyle::Custom`) would lead `consume_same_line_comments` to not return the correct byte position for the end of the comment. This issue cascaded into a situation where an extra indented newline was inserted into rustfmts output causing a `"left behind trailing whitespace"` error. Removing leading whitespace helps to properly identify the end of the comment and properly rewrite the comment.
Remove each comment's leading whitespace in `comment::rewrite_comment`
Co-authored-by: Jieyou Xu <jieyouxu@outlook.com>
Co-authored-by: Jieyou Xu <jieyouxu@outlook.com>
feat: add icu4x and all unicode-rs repo to check_diff
Capture the pre-fix output for wrapping, normalization, and style editions, including the malformed comments produced by the existing formatter.
The test case ones / hacking ones should probably come first.
…ulti-line-block-comments Fix unclosed trailing block comments with `wrap_comments=true` or `normalize_comments=true`
formatting empty where clauses when there are return types
Add TL;DR LLM usage policy, fuzzing guidelines, PR lifecycle, and a small TOC to contributing docs
…st] annotation These tests were changed to use `file!()` instead of `.`. Using `file!()` will ensure that rustfmt's `rustfmt.toml` is loaded even when running in r-l/r's CI. As a result, we now need to use `#[nightly_only_test]` since unstable option's are set in rustfmt's `rustfmt.toml`. Although this doesn't fully address the `--print-config current` issue, preventing the wrong `rustfmt.toml` from loading should help us prevent another case like rust-lang/rust 165713.
…unning_in_rust_lang_rust_ci test: rework `--print-config current` tests and add `#[nightly_only_test]` annotation
…lit-link-destinations Don't split link destinations when wrap_comments is enabled
There are some test files that used `newline_style=Windows` but never
actually added those line endings in the corresponding `target`. In
these cases carriage returns are added to the `target` files, but not
the `source` ones we also assert that we do indeed convert the line
endings.
The files `tests/{target,source}/configs/enum_discrim_align_threshold/40.rs` had
CRLF line endings, but no corresponding `newline_style` option and the
feature does not depend on line endings, so these were converted back to
use Unix line endings
The `empty_file` test was split up since the behaviour depends on the
system we're running on:
`formatting::newline_style::auto_detect_newline_style` defaults to
`Native` when it can't determine which style to use, when the file is
empty we hit this behaviour.
And `CRLF` endings were removed from `tests/writemode/target/stdin.xml`,
these endings were added with 34d374e
but looks to be accidental, nothing about the library code change in
that commit required these endings.
| // running with `file!` will load the root `rustfmt.toml` | ||
| file!(), |
There was a problem hiding this comment.
I believe this worked in rustfmt repo because there we tend to run tests from workspace root. But in r-l/r the CWD is changed to be the src/tools/rustfmt folder, which I think mucks up the relative paths that rustc gets, which in turn affects what file!() produces.
---- print_config_merges_multiple_overrides_from_args stdout ----
cwd: "/home/joe/repos/rust/src/tools/rustfmt"
"src/tools/rustfmt/tests/rustfmt/main.rs"
abs => "/home/joe/repos/rust/src/tools/rustfmt/src/tools/rustfmt/tests/rustfmt/main.rs"
We can fix it by anchoring against CARGO_MANIFEST_DIR which will point to the directory containing rustfmt's Cargo.toml, which should be relatively stable between both rustfmt repo and as an r-l/r subtree.
There was a problem hiding this comment.
I really thought file!() would work in both places. If CARGO_MANIFEST_DIR works then that should be good too!
|
@rustbot review |
|
@bors r+ p=1 rollup=never |
rustfmt subtree update 2026-11-18 Subtree update of `rustfmt` to rust-lang/rustfmt@681514c. Created using https://github.com/rust-lang/josh-sync. r? @ytmimi
This comment has been minimized.
This comment has been minimized.
|
The job Click to see the possible cause of the failure (guessed by this bot)Important For more information how to resolve CI failures of this job, visit this link. |
|
💔 Test for 889a555 failed: CI. Failed job:
|
This comment has been minimized.
This comment has been minimized.
rustfmt subtree update 2026-11-18 try-job: test-x86_64-gnu-parallel-frontend
This comment has been minimized.
This comment has been minimized.
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing 65ce861 (parent) -> e3b9a83 (this PR) Test differencesShow 8 test diffsStage 1
Additionally, 2 doctest diffs were found. These are ignored, as they are noisy. Job group index Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard e3b9a8345a8a58fda3ac9446c532625d5a59acd8 --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (e3b9a83): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis perf run didn't have relevant results for this metric. Max RSS (memory usage)Results (primary -1.3%, secondary 0.6%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary 0.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 458.82s -> 459.437s (0.13%) |
View all comments
Subtree update of
rustfmtto rust-lang/rustfmt@681514c.Created using https://github.com/rust-lang/josh-sync.
r? @ytmimi