Skip to content

Commit 9cf699d

Browse files
committed
Auto merge of #98412 - calebcartwright:sync-rustfmt, r=calebcartwright
Sync rustfmt We had a bug in the update we made ~1 week ago, so running a somewhat early sync to pull the fix in
2 parents 8aab472 + 993ee00 commit 9cf699d

File tree

40 files changed

+534
-11634
lines changed

40 files changed

+534
-11634
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4712,7 +4712,7 @@ dependencies = [
47124712

47134713
[[package]]
47144714
name = "rustfmt-nightly"
4715-
version = "1.5.0"
4715+
version = "1.5.1"
47164716
dependencies = [
47174717
"annotate-snippets 0.9.1",
47184718
"anyhow",

src/tools/rustfmt/.github/workflows/linux.yml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,5 @@ jobs:
3535
sh rustup-init.sh -y --default-toolchain none
3636
rustup target add ${{ matrix.target }}
3737
38-
- name: build
39-
run: |
40-
rustc -Vv
41-
cargo -V
42-
cargo build
43-
env:
44-
RUSTFLAGS: '-D warnings'
45-
46-
- name: test
47-
run: cargo test
48-
env:
49-
RUSTFLAGS: '-D warnings'
38+
- name: Build and Test
39+
run: ./ci/build_and_test.sh

src/tools/rustfmt/.github/workflows/mac.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,5 @@ jobs:
3232
sh rustup-init.sh -y --default-toolchain none
3333
rustup target add ${{ matrix.target }}
3434
35-
- name: build
36-
run: |
37-
rustc -Vv
38-
cargo -V
39-
cargo build
40-
41-
- name: test
42-
run: cargo test
35+
- name: Build and Test
36+
run: ./ci/build_and_test.sh

src/tools/rustfmt/.github/workflows/windows.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,6 @@ jobs:
5757
if: matrix.target == 'x86_64-pc-windows-gnu' && matrix.channel == 'nightly'
5858
shell: bash
5959

60-
- name: build
61-
run: |
62-
rustc -Vv
63-
cargo -V
64-
cargo build
65-
shell: cmd
66-
67-
- name: test
68-
run: cargo test
60+
- name: Build and Test
6961
shell: cmd
62+
run: ci\build_and_test.bat

src/tools/rustfmt/CHANGELOG.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,29 @@
22

33
## [Unreleased]
44

5-
## [1.5.0] 2022-06-13
5+
## [1.5.1] 2022-06-24
6+
7+
**N.B** A bug was introduced in v1.5.0/nightly-2022-06-15 which modified formatting. If you happened to run rustfmt over your code with one of those ~10 nightlies it's possible you may have seen formatting changes, and you may see additional changes after this fix since that bug has now been reverted.
8+
9+
### Fixed
10+
11+
- Correct an issue introduced in v1.5.0 where formatting changes were unintentionally introduced in a few cases with a large/long construct in a right hand side position (e.g. a large chain on the RHS of a local/assignment statement)
12+
- `cargo fmt --version` properly displays the version value again [#5395](https://github.com/rust-lang/rustfmt/issues/5395)
13+
14+
### Changed
15+
16+
- Properly sort imports containing raw identifiers [#3791](https://github.com/rust-lang/rustfmt/issues/3791) (note this is change version gated, and not applied by default)
17+
18+
### Added
19+
20+
- Add new configuration option, `doc_comment_code_block_width`, which allows for setting a shorter width limit to use for formatting code snippets in doc comments [#5384](https://github.com/rust-lang/rustfmt/issues/5384)
21+
22+
### Install/Download Options
23+
- **rustup (nightly)** - nightly-2022-06-24
24+
- **GitHub Release Binaries** - [Release v1.5.1](https://github.com/rust-lang/rustfmt/releases/tag/v1.5.0)
25+
- **Build from source** - [Tag v1.5.1](https://github.com/rust-lang/rustfmt/tree/v1.5.1), see instructions for how to [install rustfmt from source][install-from-source]
26+
27+
## [1.5.0] 2022-06-14
628

729
### Changed
830

@@ -75,7 +97,7 @@
7597
- Improved performance when formatting large and deeply nested expression trees, often found in generated code, which have many expressions that exceed `max_width` [#5128](https://github.com/rust-lang/rustfmt/issues/5128), [#4867](https://github.com/rust-lang/rustfmt/issues/4867), [#4476](https://github.com/rust-lang/rustfmt/issues/4476), [#5139](https://github.com/rust-lang/rustfmt/pull/5139)
7698

7799
### Install/Download Options
78-
- **rustup (nightly)** - *pending*
100+
- **rustup (nightly)** - nightly-2022-06-15
79101
- **GitHub Release Binaries** - [Release v1.5.0](https://github.com/rust-lang/rustfmt/releases/tag/v1.5.0)
80102
- **Build from source** - [Tag v1.5.0](https://github.com/rust-lang/rustfmt/tree/v1.5.0), see instructions for how to [install rustfmt from source][install-from-source]
81103

src/tools/rustfmt/Cargo.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ dependencies = [
485485

486486
[[package]]
487487
name = "rustfmt-nightly"
488-
version = "1.5.0"
488+
version = "1.5.1"
489489
dependencies = [
490490
"annotate-snippets",
491491
"anyhow",

src/tools/rustfmt/Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22

33
name = "rustfmt-nightly"
4-
version = "1.5.0"
4+
version = "1.5.1"
55
description = "Tool to find and fix Rust formatting issues"
66
repository = "https://github.com/rust-lang/rustfmt"
77
readme = "README.md"
@@ -65,3 +65,7 @@ rustfmt-config_proc_macro = { version = "0.2", path = "config_proc_macro" }
6565
rustc-workspace-hack = "1.0.0"
6666

6767
# Rustc dependencies are loaded from the sysroot, Cargo doesn't know about them.
68+
69+
[package.metadata.rust-analyzer]
70+
# This package uses #[feature(rustc_private)]
71+
rustc_private = true

src/tools/rustfmt/Configurations.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,14 @@ fn add_one(x: i32) -> i32 {
926926
}
927927
```
928928

929+
## `doc_comment_code_block_width`
930+
931+
Max width for code snippets included in doc comments. Only used if [`format_code_in_doc_comments`](#format_code_in_doc_comments) is true.
932+
933+
- **Default value**: `100`
934+
- **Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
935+
- **Stable**: No (tracking issue: [#5359](https://github.com/rust-lang/rustfmt/issues/5359))
936+
929937
## `format_generated_files`
930938

931939
Format generated files. A file is considered generated
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
set "RUSTFLAGS=-D warnings"
2+
3+
:: Print version information
4+
rustc -Vv || exit /b 1
5+
cargo -V || exit /b 1
6+
7+
:: Build and test main crate
8+
cargo build --locked || exit /b 1
9+
cargo test || exit /b 1
10+
11+
:: Build and test other crates
12+
cd config_proc_macro || exit /b 1
13+
cargo build --locked || exit /b 1
14+
cargo test || exit /b 1
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
export RUSTFLAGS="-D warnings"
6+
7+
# Print version information
8+
rustc -Vv
9+
cargo -V
10+
11+
# Build and test main crate
12+
cargo build --locked
13+
cargo test
14+
15+
# Build and test other crates
16+
cd config_proc_macro
17+
cargo build --locked
18+
cargo test

0 commit comments

Comments
 (0)