Skip to content

Commit 4720773

Browse files
committed
Merge remote-tracking branch 'upstream/main' into subtree-push-nightly-2025-12-06
Note that this merge conflict only makes `rustfmt` **buildable**, some tests (such as idempotency!) are still failing! # Merge conflict resolution - Manually retained `src/parse/macros/asm.rs` (upstream change is rust-lang/rust#140367, local removal was #6698). - Several divergences between the `Option<String>` `rust-lang/rust` copy is stuck on, versus the `RewriteResult`s in `rustfmt` tree. When this happens, I changed the signature to use `RewriteResult` to match `rustfmt` tree. - Changed some helpers e.g. `offset_left` to `offset_left_opt`, while for others I had to add spans in places. Whenever this is needed, I take the `rustfmt` version as the "ground truth" and tried to keep close to `rustfmt`s version as much as possible. - There's a few place that I had to add `.unknown_error()` to to convert between missing snippets' `Option<usize>` to `RewriteResult` to match `rustfmt` tree's version. - Removed a few `.()`s to match `rustfmt` tree's version. - Changed a few `.rewrite()` to `.rewrite_result()`. - Changed a few `return None;` -> `Err(RewriteError::Unknown);`. - `format_trait_alias` is a bit non-trivial, the signature diverges. I modified the signature and body to match the `rustfmt` tree's version, because the rust copy's signature obviously does not have sufficient span info for rustfmt to work with. However, I also had to kinda mix-and-match, because the `rustfmt` tree's version did not have const formatting. - I had to improvise here and added a `constness: &ast::Const` parameter. - Please review carefully, this diverges from *both* copies! - Fixed a trivial conflict from removal of AST `P<>` (`item.into_inner()` -> `*item`). - Fixed removal of `TokenKind::{OpenDelim,CloseDelim}` with `TokenKind:: {OpenBrace,CloseBrace}` directly. - Changed `FmtVisitor::with_context` to the `rustfmt` version where `RewriteResult` is expected of the closure return. Also modified some `rw` -> `rw.ok()` to match `rustfmt`.
2 parents e4f4af2 + d5012d8 commit 4720773

File tree

238 files changed

+5075
-836
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

238 files changed

+5075
-836
lines changed

.github/workflows/check_diff.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
workflow_dispatch:
44
inputs:
55
clone_url:
6-
description: 'Git url of a rustfmt fork to compare against the latest master rustfmt'
6+
description: 'Git url of a rustfmt fork to compare against the latest rustfmt'
77
required: true
88
branch_name:
99
description: 'Name of the feature branch on the forked repo'

.github/workflows/integration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: integration
22
on:
33
push:
44
branches:
5-
- master
5+
- main
66
pull_request:
77

88
jobs:

.github/workflows/linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: linux
22
on:
33
push:
44
branches:
5-
- master
5+
- main
66
pull_request:
77

88
jobs:

.github/workflows/mac.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: mac
22
on:
33
push:
44
branches:
5-
- master
5+
- main
66
pull_request:
77

88
jobs:

.github/workflows/rustdoc_check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: rustdoc check
22
on:
33
push:
44
branches:
5-
- master
5+
- main
66
pull_request:
77

88
jobs:

.github/workflows/windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: windows
22
on:
33
push:
44
branches:
5-
- master
5+
- main
66
pull_request:
77

88
jobs:

CHANGELOG.md

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,38 @@
11
# Changelog
22

3+
## [Unreleased]
4+
5+
6+
## [1.9.0] 2025-01-03
7+
8+
### Fixed
9+
- No longer strip `r#` prefix from `break` and `continue` labels [#6411](https://github.com/rust-lang/rustfmt/issues/6411)
10+
```rust
11+
fn main() {
12+
'r#if: {
13+
break 'r#if;
14+
}
15+
}
16+
```
17+
- Fix panic when sorting imports [#6333](https://github.com/rust-lang/rustfmt/issues/6333)
18+
- Fix issue with `wrap_comments` invalidating code blocks [#6417](https://github.com/rust-lang/rustfmt/pull/6417)
19+
- No longer remove closure block label within a macro call [#6465](https://github.com/rust-lang/rustfmt/issues/6465)
20+
21+
### Changed
22+
- Stabilize `style_edition=2024` and stabilize the `style_edition` command line option [#6431](https://github.com/rust-lang/rustfmt/pull/6431) [rust-lang/rust#134929](https://github.com/rust-lang/rust/pull/134929)
23+
- Apply version sorting to module declarations when using `style_edition=2024` [#6368](https://github.com/rust-lang/rustfmt/pull/6368)
24+
- When users set the deprecated `version` config, rustfmt now gives a hint about which equivalent `style_edition` they should use [#6361](https://github.com/rust-lang/rustfmt/pull/6361)
25+
- Correct version chunk splitting in the internal version sort algorithm [#6407](https://github.com/rust-lang/rustfmt/pull/6407)
26+
- Extend support for single line let-chain formatting to include cases where the left hand side operand is a literal, in alignment with finalized style rules as part of let-chain stabilization [#6492](https://github.com/rust-lang/rustfmt/pull/6492)
27+
- Begin initial formatting for `use closures` and `use chains` (`#![feature(ergonomic_clones)]`). Previously, the closure and chain was left as the developer wrote it [#6532](https://github.com/rust-lang/rustfmt/pull/6532)
28+
29+
### Added
30+
- Add `style_edition=2027` to gate unstable formatting [#6324](https://github.com/rust-lang/rustfmt/pull/6324)
31+
- Support discovering and formatting files via external mods imported within `cfg_match`, similar to `cfg_if` behavior [#6522](https://github.com/rust-lang/rustfmt/pull/6522)
32+
- Add new nightly-only `match_arm_indent` option [#6525](https://github.com/rust-lang/rustfmt/pull/6525)
33+
- more details in the [configuration section for this new option](https://github.com/rust-lang/rustfmt/blob/HEAD/Configurations.md#match_arm_indent)
34+
35+
336
## [1.8.0] 2024-09-20
437

538
### Fixed
@@ -39,7 +72,7 @@
3972
use std::num::{NonZeroU8, NonZeroU16, NonZeroU32, NonZeroU64};
4073
```
4174
[style guide's version sorting algorithm]: https://doc.rust-lang.org/nightly/style-guide/#sorting
42-
- When parsing rustfmt configurations fails, rustfmt will now include the path to the toml file in the erorr message [#6302](https://github.com/rust-lang/rustfmt/issues/6302)
75+
- When parsing rustfmt configurations fails, rustfmt will now include the path to the toml file in the error message [#6302](https://github.com/rust-lang/rustfmt/issues/6302)
4376

4477
### Added
4578
- rustfmt now formats trailing where clauses in type aliases [#5887](https://github.com/rust-lang/rustfmt/pull/5887)
@@ -133,7 +166,7 @@
133166
### Changed
134167

135168
- `hide_parse_errors` has been soft deprecated and it's been renamed to `show_parse_errors` [#5961](https://github.com/rust-lang/rustfmt/pull/5961).
136-
- The diff output produced by `rustfmt --check` is more compatable with editors that support navigating directly to line numbers [#5971](https://github.com/rust-lang/rustfmt/pull/5971)
169+
- The diff output produced by `rustfmt --check` is more compatible with editors that support navigating directly to line numbers [#5971](https://github.com/rust-lang/rustfmt/pull/5971)
137170
- When using `version=Two`, the `trace!` macro from the [log crate] is now formatted similarly to `debug!`, `info!`, `warn!`, and `error!` [#5987](https://github.com/rust-lang/rustfmt/issues/5987).
138171

139172
[log crate]: https://crates.io/crates/log
@@ -298,7 +331,7 @@
298331

299332
### Added
300333

301-
- New configuration option [`skip_macro_invocations`](https://rust-lang.github.io/rustfmt/?version=master&search=#skip_macro_invocations) [#5347](https://github.com/rust-lang/rustfmt/pull/5347) that can be used to globally define a single enumerated list of macro calls that rustfmt should skip formatting. rustfmt [currently also supports this via a custom tool attribute](https://github.com/rust-lang/rustfmt#tips), however, these cannot be used in all contexts because [custom inner attributes are unstable](https://github.com/rust-lang/rust/issues/54726)
334+
- New configuration option [`skip_macro_invocations`](https://rust-lang.github.io/rustfmt/?version=main&search=#skip_macro_invocations) [#5347](https://github.com/rust-lang/rustfmt/pull/5347) that can be used to globally define a single enumerated list of macro calls that rustfmt should skip formatting. rustfmt [currently also supports this via a custom tool attribute](https://github.com/rust-lang/rustfmt#tips), however, these cannot be used in all contexts because [custom inner attributes are unstable](https://github.com/rust-lang/rust/issues/54726)
302335

303336
### Misc
304337

0 commit comments

Comments
 (0)