Skip to content

rustfmt subtree update#153145

Merged
rust-bors[bot] merged 286 commits intorust-lang:mainfrom
ytmimi:rustfmt-subtree-update
Feb 27, 2026
Merged

rustfmt subtree update#153145
rust-bors[bot] merged 286 commits intorust-lang:mainfrom
ytmimi:rustfmt-subtree-update

Conversation

@ytmimi
Copy link
Copy Markdown
Contributor

@ytmimi ytmimi commented Feb 26, 2026

r? @ghost

Nadrieril and others added 30 commits November 24, 2024 22:57
Avoid "width" since it can get confused with the width field.
URL is pronounced by spelling out each letter, therefore, it doesn't
start with a vowel sound.
Replaces `char::is_numeric()` with `char::is_ascii_digit()` in
`VersionChunkIter::parse_str_chunk()`.

The text in the Style Guide explicitly mentions that a numeric chunk
is a sequence of ASCII digits.
* Use RewriteResult in rewrite_reorderable_or_regroupable_items
* Use RewriteResult in visit_item
I want to make it clearer that these tests are associated with the
unstable `unsafe_fields` feature.
And pass this to the individual emitters when necessary.
…r=fee1-dead

Parse guard patterns

This implements the parsing of [RFC3637 Guard Patterns](https://rust-lang.github.io/rfcs/3637-guard-patterns.html) (see also [tracking issue](rust-lang#129967)). This PR is extracted from rust-lang#129996 with minor modifications.

cc `@max-niederman`
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#133567 (A bunch of cleanups)
 - rust-lang#133789 (Add doc alias 'then_with' for `then` method on `bool`)
 - rust-lang#133880 (Expand home_dir docs)
 - rust-lang#134036 (crash tests: use individual mir opts instead of mir-opt-level where easily possible)
 - rust-lang#134045 (Fix some triagebot mentions paths)
 - rust-lang#134046 (Remove ignored tests for hangs w/ new solver)
 - rust-lang#134050 (Miri subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
…r paths involving them

When we expand a `mod foo;` and parse `foo.rs`, we now track whether that file had an unrecovered parse error that reached the end of the file. If so, we keep that information around. When resolving a path like `foo::bar`, we do not emit any errors for "`bar` not found in `foo`", as we know that the parse error might have caused `bar` to not be parsed and accounted for.

When this happens in an existing project, every path referencing `foo` would be an irrelevant compile error. Instead, we now skip emitting anything until `foo.rs` is fixed. Tellingly enough, we didn't have any test for errors caused by `mod` expansion.

Fix rust-lang#97734.
…24-12-02

subtree-push nightly-2024-12-02
…, r=oli-obk

Add AST support for unsafe binders

I'm splitting up rust-lang#130514 into pieces. It's impossible for me to keep up with a huge PR like that. I'll land type system support for this next, probably w/o MIR lowering, which will come later.

r? `@oli-obk`
cc `@BoxyUwU` and `@lcnr` who also may want to look at this, though this PR doesn't do too much yet
As it happens, lookahead values of 0, 1, and 2 all work fine here, due
to the structure of the code. (Values or 3 or greater cause test
failures.) This commit changes the lookahead to zero because that will
facilitate cleanups in subsequent commits.
It's only ever used with a lookahead of 0, so this commit removes the
lookahead and renames it `peek`.
Because `TokenStreamIter` is a much better name for a `TokenStream`
iterator. Also rename the `TokenStream::trees` method as
`TokenStream::iter`, and some local variables.
`rustc_symbol` is the source of truth for keywords.

rustdoc has its own implicit definition of keywords, via the
`is_doc_keyword`. It (presumably) intends to include all keywords, but
it omits `yeet`.

rustfmt has its own explicit list of Rust keywords. It also (presumably)
intends to include all keywords, but it omits `await`, `builtin`, `gen`,
`macro_rules`, `raw`, `reuse`, `safe`, and `yeet`. Also, it does linear
searches through this list, which is inefficient.

This commit fixes all of the above problems by introducing a new
predicate `is_any_keyword` in rustc and using it in rustdoc and rustfmt.
It documents that it's not the right predicate in most cases.
…etrochenkov

Overhaul keyword handling

The compiler's list of keywords has some problems.
- It contains several items that aren't keywords.
- The order isn't quite right in a couple of places.
- Some of the names of predicates relating to keywords are confusing.
- rustdoc and rustfmt have their own (incorrect) versions of the keyword list.
- `AllKeywords` is unnecessarily complex.

r? ```@jieyouxu```
The parser pushes a `TokenType` to `Parser::expected_token_types` on
every call to the various `check`/`eat` methods, and clears it on every
call to `bump`. Some of those `TokenType` values are full tokens that
require cloning and dropping. This is a *lot* of work for something
that is only used in error messages and it accounts for a significant
fraction of parsing execution time.

This commit overhauls `TokenType` so that `Parser::expected_token_types`
can be implemented as a bitset. This requires changing `TokenType` to a
C-style parameterless enum, and adding `TokenTypeSet` which uses a
`u128` for the bits. (The new `TokenType` has 105 variants.)

The new types `ExpTokenPair` and `ExpKeywordPair` are now arguments to
the `check`/`eat` methods. This is for maximum speed. The elements in
the pairs are always statically known; e.g. a
`token::BinOp(token::Star)` is always paired with a `TokenType::Star`.
So we now compute `TokenType`s in advance and pass them in to
`check`/`eat` rather than the current approach of constructing them on
insertion into `expected_token_types`.

Values of these pair types can be produced by the new `exp!` macro,
which is used at every `check`/`eat` call site. The macro is for
convenience, allowing any pair to be generated from a single identifier.

The ident/keyword filtering in `expected_one_of_not_found` is no longer
necessary. It was there to account for some sloppiness in
`TokenKind`/`TokenType` comparisons.

The existing `TokenType` is moved to a new file `token_type.rs`, and all
its new infrastructure is added to that file. There is more boilerplate
code than I would like, but I can't see how to make it shorter.
Bumping the toolchain version as part of a git subtree push

current toolchain (nightly-2024-12-02):
  - 1.85.0-nightly (5e1440a 2024-12-01)

latest toolchain (nightly-2025-01-02):
  - 1.85.0-nightly (45d11e5 2025-01-01)
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Feb 26, 2026

Some changes occurred in src/tools/rustfmt

cc @rust-lang/rustfmt

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue. labels Feb 26, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Feb 26, 2026

⚠️ Warning ⚠️

@rust-log-analyzer

This comment has been minimized.

@ytmimi
Copy link
Copy Markdown
Contributor Author

ytmimi commented Feb 26, 2026

@bors r+ p=1 rollup=never

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Feb 26, 2026

📌 Commit 02a4978 has been approved by ytmimi

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 26, 2026
@rust-bors

This comment has been minimized.

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Feb 27, 2026

☀️ Test successful - CI
Approved by: ytmimi
Duration: 4h 56m 44s
Pushing 0ee5907 to main...

@rust-bors rust-bors Bot added merged-by-bors This PR was explicitly merged by bors. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 27, 2026
@rust-bors rust-bors Bot merged commit 0ee5907 into rust-lang:main Feb 27, 2026
12 checks passed
@rustbot rustbot added this to the 1.95.0 milestone Feb 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

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 6a979b3 (parent) -> 0ee5907 (this PR)

Test differences

Show 57 test diffs

Stage 1

  • config::options::style_edition_comparisons: [missing] -> pass (J0)
  • config::test::check_semver_version::test_build_metadata_ignored: [missing] -> pass (J0)
  • config::test::check_semver_version::test_caret_requirement_matches_minor_update: [missing] -> pass (J0)
  • config::test::check_semver_version::test_exact_version_match: [missing] -> pass (J0)
  • config::test::check_semver_version::test_greater_than_requirement: [missing] -> pass (J0)
  • config::test::check_semver_version::test_invalid_inputs: [missing] -> pass (J0)
  • config::test::check_semver_version::test_invalid_or: [missing] -> pass (J0)
  • config::test::check_semver_version::test_less_than_requirement_fails_when_greater: [missing] -> pass (J0)
  • config::test::check_semver_version::test_major_version_less: [missing] -> pass (J0)
  • config::test::check_semver_version::test_minor_version_greater: [missing] -> pass (J0)
  • config::test::check_semver_version::test_patch_version_greater: [missing] -> pass (J0)
  • config::test::check_semver_version::test_pre_release_lexicographic_ordering: [missing] -> pass (J0)
  • config::test::check_semver_version::test_pre_release_non_match_when_requiring_release: [missing] -> pass (J0)
  • config::test::check_semver_version::test_pre_release_numeric_vs_alphanumeric: [missing] -> pass (J0)
  • config::test::check_semver_version::test_pre_release_specific_match: [missing] -> pass (J0)
  • config::test::check_semver_version::test_prerelease_less_than_release: [missing] -> pass (J0)
  • config::test::check_semver_version::test_prerelease_version_specific_match: [missing] -> pass (J0)
  • config::test::check_semver_version::test_range_requirement_inclusive: [missing] -> pass (J0)
  • config::test::check_semver_version::test_tilde_requirement_matches_patch_update: [missing] -> pass (J0)
  • config::test::check_semver_version::test_version_mismatch: [missing] -> pass (J0)
  • config::test::check_semver_version::test_version_with_pre_release_and_build: [missing] -> pass (J0)
  • config::test::check_semver_version::test_wildcard_any: [missing] -> pass (J0)
  • config::test::check_semver_version::test_wildcard_any_with_range: [missing] -> pass (J0)
  • config::test::check_semver_version::test_wildcard_match_major: [missing] -> pass (J0)
  • config::test::check_semver_version::test_wildcard_match_minor: [missing] -> pass (J0)
  • config::test::check_semver_version::test_wildcard_match_patch: [missing] -> pass (J0)
  • config::test::check_semver_version::test_wildcard_mismatch: [missing] -> pass (J0)
  • config::test::required_version::test_current_required_version: [missing] -> pass (J0)
  • config::test::required_version::test_required_version_above: [missing] -> pass (J0)
  • config::test::required_version::test_required_version_below: [missing] -> pass (J0)
  • config::test::required_version::test_required_version_caret: [missing] -> pass (J0)
  • config::test::required_version::test_required_version_complex_range: [missing] -> pass (J0)
  • config::test::required_version::test_required_version_default: [missing] -> pass (J0)
  • config::test::required_version::test_required_version_exact_boundary: [missing] -> pass (J0)
  • config::test::required_version::test_required_version_fail_different_operator: [missing] -> pass (J0)
  • config::test::required_version::test_required_version_future_major_version: [missing] -> pass (J0)
  • config::test::required_version::test_required_version_greater_than: [missing] -> pass (J0)
  • config::test::required_version::test_required_version_invalid_specification: [missing] -> pass (J0)
  • config::test::required_version::test_required_version_less_than: [missing] -> pass (J0)
  • config::test::required_version::test_required_version_major_version_zero: [missing] -> pass (J0)
  • config::test::required_version::test_required_version_pre_release: [missing] -> pass (J0)
  • config::test::required_version::test_required_version_range: [missing] -> pass (J0)
  • config::test::required_version::test_required_version_tilde: [missing] -> pass (J0)
  • config::test::required_version::test_required_version_wildcard_any: [missing] -> pass (J0)
  • config::test::required_version::test_required_version_wildcard_major: [missing] -> pass (J0)
  • config::test::required_version::test_required_version_with_build_metadata: [missing] -> pass (J0)
  • expr::test::test_float_lit_ends_in_dot: [missing] -> pass (J0)
  • expr::test::test_parse_float_symbol: [missing] -> pass (J0)
  • expr::test::test_parse_float_symbol_with_underscores: [missing] -> pass (J0)
  • rustfmt_allow_not_a_dir_errors: [missing] -> pass (J0)
  • test::format_files_find_new_files_via_cfg_match: [missing] -> pass (J0)

Additionally, 6 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 0ee5907d597b02afadb5daa26a60fedb72f098d1 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. aarch64-apple: 3h 15m -> 4h 49m (+48.3%)
  2. x86_64-gnu-llvm-20-3: 1h 39m -> 1h 58m (+18.7%)
  3. i686-gnu-2: 1h 26m -> 1h 40m (+17.2%)
  4. x86_64-rust-for-linux: 44m 42s -> 51m 50s (+15.9%)
  5. dist-aarch64-apple: 1h 50m -> 2h 6m (+14.7%)
  6. pr-check-1: 28m 36s -> 32m 35s (+14.0%)
  7. x86_64-gnu-llvm-20: 1h 9m -> 1h 18m (+13.3%)
  8. x86_64-gnu-tools: 55m -> 1h 2m (+13.1%)
  9. test-various: 1h 52m -> 2h 6m (+12.1%)
  10. i686-gnu-nopt-1: 2h 3m -> 2h 17m (+11.8%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (0ee5907): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (secondary -2.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.5% [2.5%, 2.5%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-7.3% [-7.3%, -7.3%] 1
All ❌✅ (primary) - - 0

Cycles

Results (primary 2.4%, secondary 3.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.4% [2.4%, 2.4%] 1
Regressions ❌
(secondary)
3.6% [2.7%, 4.3%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.4% [2.4%, 2.4%] 1

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 484.473s -> 481.376s (-0.64%)
Artifact size: 397.64 MiB -> 395.63 MiB (-0.51%)

@jieyouxu
Copy link
Copy Markdown
Member

CI time is aarch64-apple again for no obvious reasons

@ytmimi ytmimi deleted the rustfmt-subtree-update branch February 27, 2026 15:21
cataggar added a commit to cataggar/rust that referenced this pull request Mar 31, 2026
…sions

Cloning the rust repo on case-insensitive filesystems (e.g. Windows,
macOS) produces warnings because the following paths collide:

  src/tools/rustfmt/tests/{source,target}/reorder_modules/ABCD/mod.rs
  src/tools/rustfmt/tests/{source,target}/reorder_modules/abcd/mod.rs
  src/tools/rustfmt/tests/{source,target}/reorder_modules/ZYXW/mod.rs
  src/tools/rustfmt/tests/{source,target}/reorder_modules/zyxw/mod.rs

These were introduced in the rustfmt subtree update (PR rust-lang#153145).

Rename the lowercase variants:
  abcd -> abcde
  zyxw -> zyxwv

This preserves the test intent (verifying case-sensitive module sorting)
while eliminating the case collision on case-insensitive filesystems.

Fixes #1

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-bors This PR was explicitly merged by bors. T-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.