Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustfmt subtree update #117066

Merged
merged 84 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
dc7dc3e
Implement `become` expression formatting in rustfmt
WaffleLapkin May 9, 2023
ed3e96e
Merge commit '3f7c366fc0464e01ddcaefbd70647cb3da4202be' into rustfmt-…
calebcartwright Jun 20, 2023
80bf3ea
Rollup merge of #112790 - WaffleLapkin:syntactically, r=Nilstrieb
Noratrieb Jun 21, 2023
78331ee
Merge commit 'dca1cf90ad6b8e45afbed2061803befbb2d159e9' into sync-rus…
calebcartwright Jul 1, 2023
9a86da9
docs: fix a few links
calebcartwright Jul 2, 2023
326af2b
Switch to tracing for logging
fee1-dead Jun 25, 2023
bb87a1b
Rewrite float literals ending in dots with parens in method calls
fee1-dead Jun 21, 2023
3c3cf61
Add failing test
CosmicHorrorDev Jun 24, 2023
8850854
Don't skip semicolon if exprs follow
CosmicHorrorDev Jun 24, 2023
d9a0992
Switch `ast::Stmt` rewriting use to `stmt::Stmt::from_simple_block`
CosmicHorrorDev Jun 24, 2023
f2bad9c
fix: handle skip_macro_invocations from config file
calebcartwright Jul 5, 2023
d0762f0
always emit consider `AutoImplCandidates` for them if they don't also…
Ddystopia Jul 4, 2023
5ed7f74
Actually use `tracing` for logging
fee1-dead Jul 6, 2023
89500fa
Add `LD_LIBRARY_PATH` in `check_diff.sh`
ytmimi Jul 10, 2023
e5c212b
Improve error discovery in `check_diff.sh`
ytmimi Jul 10, 2023
d698bf4
use the `branch_name` as the default for the optional commit hash
ytmimi Jul 10, 2023
e9dfb6f
fix link in CHANGELOG.md
xxchan Jul 17, 2023
e0e633e
Use matches!() macro to improve readability (#5830)
jmqd Jul 17, 2023
1842967
automatically add pr-not-reviewed to new PRs (#5843)
fee1-dead Jul 19, 2023
b944a32
Prevent ICE when formatting an empty-ish macro arm (#5833)
tdanniels Jul 19, 2023
6013a80
On nightly, dump ICE backtraces to disk
estebank Mar 3, 2023
c6d39a2
doc: fix instruction about running Rustfmt from source code (#5838)
xxchan Jul 19, 2023
2db13f4
Support non-lifetime binders
compiler-errors Jul 19, 2023
a9ae746
misc code cleanup
fee1-dead Jul 18, 2023
a3dfd82
Use a builder instead of boolean/option arguments
oli-obk Jul 25, 2023
c0ee8f5
Make `x test src/tools/rustfmt --bless` format rustfmt with the fresh…
oli-obk Jul 26, 2023
08fd164
Unite bless environment variables under `RUSTC_BLESS`
tgross35 Jul 3, 2023
e60a9e2
Avoid `into_trees` usage in rustfmt.
nnethercote Jul 27, 2023
cdfa2f8
Handle `dyn*` syntax when rewriting `ast::TyKind::TraitObject`
ytmimi Sep 30, 2022
1f369f8
Auto merge of #114115 - nnethercote:less-token-tree-cloning, r=petroc…
bors Jul 28, 2023
4eeecae
Auto merge of #113312 - Ddystopia:auto-trait-fun, r=lcnr
bors Jul 28, 2023
f122a33
Use builder pattern instead of lots of arguments for `EmitterWriter::…
oli-obk Jul 25, 2023
a72613b
Add parenthesis around closure method call
Centri3 Jul 18, 2023
e42bc9e
Fix rustfmt dep
mu001999 Aug 2, 2023
d165d4a
Remove `MacDelimiter`.
nnethercote Aug 1, 2023
2c8cc96
Rollup merge of #114300 - MU001999:fix/turbofish-pat, r=estebank
matthiaskrgr Aug 3, 2023
e83a7ca
Improve spans for indexing expressions
Noratrieb Aug 3, 2023
e6c4606
Auto merge of #114104 - oli-obk:syn2, r=compiler-errors
bors Aug 4, 2023
af72b88
Rollup merge of #114434 - Nilstrieb:indexing-spans, r=est31
matthiaskrgr Aug 4, 2023
00b60cd
Auto merge of #114481 - matthiaskrgr:rollup-58pczpl, r=matthiaskrgr
bors Aug 4, 2023
36af403
improve the --file-lines help (#5846)
richardmon Aug 12, 2023
9f58224
Update Unicode data to 15.0
crlf0710 Jul 29, 2023
0d4c143
Improve formatting of empty macro_rules! definitions
ytmimi Aug 11, 2023
177ef66
Fix building rustfmt with `--features generic-simd`
ytmimi Aug 2, 2023
641d4f5
Build nightly rustfmt using `--all-features` in CI
ytmimi Aug 2, 2023
d8aeaba
include block label length when calculating pat_shape of a match arm
ytmimi Jan 26, 2023
e86c2ba
Don't flatten blocks that have labels
ytmimi Jan 26, 2023
b069aac
Inline format arguments for easier reading (#5881)
nyurik Aug 13, 2023
4b01e62
refactor ABI formatting (#5845)
fee1-dead Aug 14, 2023
a57d57b
Remove newlines in where clauses for v2
kevinji Jul 30, 2023
e480739
Prevent ICE when formatting item-only `vec!{}` (#5879)
tdanniels Aug 17, 2023
16db2a4
Use `OR` operator in Cargo.toml `license` field
kevinji Aug 18, 2023
cef3117
Parse unnamed fields and anonymous structs or unions
frank-king Aug 23, 2023
0439486
Fix link in CHANGELOG.md (#5894)
cstyles Aug 26, 2023
df2471b
Fix typos in index.html (#5896)
gentoid Aug 27, 2023
f89cd3c
Don't treat lines starting with `.` or `)` as ordered markdown lists …
xxchan Aug 29, 2023
9c25fbf
Use conditional synchronization for Lock
Zoxc Oct 31, 2020
1340fc4
Fix issues with formatting imports with comments
rsammelson Jul 21, 2023
c7c57f8
Fix issue with extra semicolon when import comment preceeds semicolon
davidBar-On Mar 17, 2021
b636723
Improve tests for #5852
rsammelson Jul 28, 2023
96e583f
Use relative positions inside a SourceFile.
cjgillot Sep 3, 2023
262feb3
Fix checking if newline is needed before `else` in let-else statement
rhysd Sep 9, 2023
b8e3cb0
Update tools and fulldeps tests
matthewjasper Sep 8, 2023
18737dd
Prefer light_rewrite_comment if it is not a doccomment (#5536)
pan93412 Sep 11, 2023
da7f678
feat(cargo): Style --help like cargo nightly (#5908)
epage Sep 12, 2023
a1fabbf
Bugfix/comment duplication (#5913)
GambitingMan Sep 20, 2023
d7669b4
Fix broken links
cuishuang Sep 30, 2023
8ac561a
Fix spans for comments in rustfmt
compiler-errors Oct 4, 2023
268716b
Add CHANGELOG entries for the next release (#5932)
ytmimi Oct 8, 2023
2707103
fix: adjust span derivation for const generics
calebcartwright Oct 8, 2023
457dc79
Add support for ExprKind::Let
camsteffen Jan 30, 2022
547577f
implement sinlge line let-chain rules
ytmimi Aug 7, 2023
0f73981
s/generator/coroutine/
oli-obk Oct 19, 2023
4b5ef37
Rename lots of files that had `generator` in their name
oli-obk Oct 20, 2023
f35f252
Merge remote-tracking branch 'upstream/master' into subtree-sync-2023…
calebcartwright Oct 22, 2023
746bf48
chore: bump toolchain and apply minor updates
calebcartwright Oct 22, 2023
75d8497
deps: bump bytecount version
calebcartwright Oct 22, 2023
c2515df
tests: fix let chain tests
calebcartwright Oct 22, 2023
0bb2acf
Merge pull request #5944 from calebcartwright/subtree-sync-2023-10-22
calebcartwright Oct 22, 2023
75c7d1d
Add outstanding changelog entries for the next release
ytmimi Oct 22, 2023
ff3ce6b
Fix typos and remove merge conflict artifacts from the changelog
ytmimi Oct 23, 2023
81fe905
chore: prep v1.7.0 release
ytmimi Oct 23, 2023
7650a75
Merge commit '81fe905ca83cffe84322f27ca43950b617861ff7' into rustfmt-…
calebcartwright Oct 23, 2023
35400e8
bump rustfmt version
calebcartwright Oct 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 27 additions & 26 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ dependencies = [

[[package]]
name = "anstyle"
version = "1.0.1"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd"
checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87"

[[package]]
name = "anstyle-parse"
Expand Down Expand Up @@ -370,11 +370,11 @@ checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1"

[[package]]
name = "bytecount"
version = "0.6.3"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c676a478f63e9fa2dd5368a42f28bba0d6c560b775f38583c8bbaa7fcd67c9c"
checksum = "ad152d03a2c813c80bb94fedbf3a3f02b28f793e39e7c214c8a0bcc196343de7"
dependencies = [
"packed_simd_2",
"packed_simd",
]

[[package]]
Expand Down Expand Up @@ -501,6 +501,16 @@ dependencies = [
"clap_derive",
]

[[package]]
name = "clap-cargo"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "383f21342a464d4af96e9a4cad22a0b4f2880d4a5b3bbf5c9654dd1d9a224ee4"
dependencies = [
"anstyle",
"clap",
]

[[package]]
name = "clap_builder"
version = "4.4.4"
Expand Down Expand Up @@ -1777,7 +1787,7 @@ version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6cb51c9a029ddc91b07a787f1d86b53ccfa49b0e86688c946ebe8d3555685dd7"
dependencies = [
"libm 0.2.7",
"libm",
]

[[package]]
Expand Down Expand Up @@ -2228,12 +2238,6 @@ dependencies = [
"windows-sys 0.48.0",
]

[[package]]
name = "libm"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a"

[[package]]
name = "libm"
version = "0.2.7"
Expand Down Expand Up @@ -2594,6 +2598,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
dependencies = [
"autocfg",
"libm",
]

[[package]]
Expand Down Expand Up @@ -2743,13 +2748,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f"

[[package]]
name = "packed_simd_2"
version = "0.3.8"
name = "packed_simd"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1914cd452d8fccd6f9db48147b29fd4ae05bea9dc5d9ad578509f72415de282"
checksum = "1f9f08af0c877571712e2e3e686ad79efad9657dbf0f7c3c8ba943ff6c38932d"
dependencies = [
"cfg-if",
"libm 0.1.4",
"num-traits",
]

[[package]]
Expand Down Expand Up @@ -4758,31 +4763,32 @@ dependencies = [

[[package]]
name = "rustfmt-nightly"
version = "1.6.0"
version = "1.7.0"
dependencies = [
"annotate-snippets",
"anyhow",
"bytecount",
"cargo_metadata 0.15.4",
"clap",
"clap-cargo",
"diff",
"dirs",
"env_logger 0.10.0",
"getopts",
"ignore",
"itertools",
"lazy_static",
"log",
"regex",
"rustfmt-config_proc_macro",
"serde",
"serde_json",
"term",
"thiserror",
"toml 0.7.5",
"tracing",
"tracing-subscriber",
"unicode-properties",
"unicode-segmentation",
"unicode-width",
"unicode_categories",
]

[[package]]
Expand Down Expand Up @@ -5676,6 +5682,7 @@ dependencies = [
"thread_local",
"tracing",
"tracing-core",
"tracing-log",
]

[[package]]
Expand Down Expand Up @@ -5891,12 +5898,6 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"

[[package]]
name = "unicode_categories"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e"

[[package]]
name = "unified-diff"
version = "0.2.1"
Expand Down
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 @@ -30,4 +30,4 @@ jobs:
rustup target add x86_64-unknown-linux-gnu

- name: check diff
run: bash ${GITHUB_WORKSPACE}/ci/check_diff.sh ${{ github.event.inputs.clone_url }} ${{ github.event.inputs.branch_name }} ${{ github.event.inputs.commit_hash }} ${{ github.event.inputs.rustfmt_configs }}
run: bash ${GITHUB_WORKSPACE}/ci/check_diff.sh ${{ github.event.inputs.clone_url }} ${{ github.event.inputs.branch_name }} ${{ github.event.inputs.commit_hash || github.event.inputs.branch_name }} ${{ github.event.inputs.rustfmt_configs }}
80 changes: 78 additions & 2 deletions src/tools/rustfmt/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,90 @@
## [Unreleased]


## [1.7.0] 2023-10-22

### Fixed

- Sometimes when `format_code_in_doc_comments=true` was set some line comments were converted to block comments [#5533](https://github.com/rust-lang/rustfmt/issues/5533)
- rustfmt will no longer remove the braces in match arms when the block has a labeled [#5676](https://github.com/rust-lang/rustfmt/issues/5676)
```rust
fn main() {
match true {
true => 'a: {
break 'a
}
_ => (),
}
}
```
- Calling methods on float literals ending in `.` will now be wrapped in parenthesis. e.g. `0. .to_string()` will be formatted as `(0.).to_string()` [#5791](https://github.com/rust-lang/rustfmt/issues/5791)
- Prevent ICE when formatting empty `macro_rules!` branch [#5730](https://github.com/rust-lang/rustfmt/issues/5730)
```rust
macro_rules! statement {
() => {;};
}
```
- Prevent ICE when formatting `vec!{}` [#5735](https://github.com/rust-lang/rustfmt/issues/5735)
- Prevent internal trailing whitespace error when formatting an empty `macro_rules!` defintion e.g. `macro_rules! foo {}` [#5882](https://github.com/rust-lang/rustfmt/issues/5882)
- Formatting doc comment lines that start with `.` or `)` won't be treated as ordered markdown lists because `.` or `)` must be preceded by a number to start an ordered markdown list [#5835](https://github.com/rust-lang/rustfmt/pull/5835)
- Add parenthesis around closures when they're used as method receives, don't have a block body, and end with `.` [#4808](https://github.com/rust-lang/rustfmt/issues/4808)
```rust
fn main() {
|| (10.).method();
(|| ..).method();
(|| 1..).method();
}
```
- Prevent removing `for<T>` when using the [`#![feature(non_lifetime_binders)]`](https://github.com/rust-lang/rust/issues/108185) [#5721](https://github.com/rust-lang/rustfmt/issues/5721)
```rust
#![feature(non_lifetime_binders)]
#![allow(incomplete_features)]

trait Other<U: ?Sized> {}

trait Trait<U>
where
for<T> U: Other<T> {}
```
- Fix various issues with comments in imports [#5852](https://github.com/rust-lang/rustfmt/issues/5852) [#4708](https://github.com/rust-lang/rustfmt/issues/4708) [#3984](https://github.com/rust-lang/rustfmt/issues/3984)
- When setting `version = Two` newlines between where clause bounds will be removed [#5655](https://github.com/rust-lang/rustfmt/issues/5655)
```rust
fn foo<T>(_: T)
where
T: std::fmt::Debug,
T: std::fmt::Display,
{
}
```
- Improve formatting of `let-else` statements that have leading attributes When setting `version = Two` [#5901](https://github.com/rust-lang/rustfmt/issues/5901)
- Prevent comment duplication in expressions wrapped in parenthesis. [#5871](https://github.com/rust-lang/rustfmt/issues/5871)
- Adjust the span derivation used when rewriting const generics. The incorrect span derivation lead to invalid code after reformatting. [#5935](https://github.com/rust-lang/rustfmt/issues/5935)


### Changed

- rustfmt no longer removes explicit `Rust` ABIs. e.g `extern "Rust" fn im_a_rust_fn() {}` [#5701](https://github.com/rust-lang/rustfmt/issues/5701)
- Setting `trailing_semicolon = false` will only remove trailing `;` on the last expression in a block [#5797](https://github.com/rust-lang/rustfmt/issues/5797)
- Update the format of `cargo help fmt` to be more consistent with other standard commands [#5908](https://github.com/rust-lang/rustfmt/pull/5908)

### Added

- Users can now set `skip_macro_invocations` in `rustfmt.toml` [#5816](https://github.com/rust-lang/rustfmt/issues/5816)
- Adds initial support for formatting `let-chains`. **`let-chains` are still a nightly feature and their formatting is subject to change** [#5910](https://github.com/rust-lang/rustfmt/pull/5910). Formatting was implemented following the rules outlined in [rust-lang/rust#110568](https://github.com/rust-lang/rust/pull/110568)

### Misc

- Support the experimental `dyn*` syntax, enabled by `#![feature(dyn_star)]` [#5542](https://github.com/rust-lang/rustfmt/issues/5542)
- Replace `unicode_categories` dependency with `unicode-properties` [#5864](https://github.com/rust-lang/rustfmt/pull/5864)

## [1.6.0] 2023-07-02

### Added

- Support for formatting let-else statements [#5690]
- New config option, `single_line_let_else_max_width`, that allows users to configure the maximum length of single line `let-else` statements. `let-else` statements that otherwise meet the requirements to be formatted on a single line will have their divergent`else` block formatted over multiple lines if they exceed this length [#5684]

[#5690]: (https://github.com/rust-lang/rustfmt/pulls/5690)
[#5690]: https://github.com/rust-lang/rustfmt/pull/5690
[#5684]: https://github.com/rust-lang/rustfmt/issues/5684

## [1.5.3] 2023-06-20
Expand All @@ -19,7 +95,7 @@

- When formatting doc comments with `wrap_comments = true` rustfmt will no longer wrap markdown tables [#4210](https://github.com/rust-lang/rustfmt/issues/4210)
- Properly handle wrapping comments that include a numbered list in markdown [#5416](https://github.com/rust-lang/rustfmt/issues/5416)
- Properly handle markdown sublists that utilize a `+` [#4041](https://github.com/rust-lang/rustfmt/issues/4210)
- Properly handle markdown sublists that utilize a `+` [#4041](https://github.com/rust-lang/rustfmt/issues/4041)
- rustfmt will no longer use shorthand initialization when rewriting a tuple struct even when `use_field_init_shorthand = true` as this leads to code that could no longer compile.
Take the following struct as an example `struct MyStruct(u64);`. rustfmt will no longer format `MyStruct { 0: 0 }` as `MyStruct { 0 }` [#5488](https://github.com/rust-lang/rustfmt/issues/5488)
- rustfmt no longer panics when formatting an empty code block in a doc comment with `format_code_in_doc_comments = true` [#5234](https://github.com/rust-lang/rustfmt/issues/5234). For example:
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rustfmt/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ A version of this document [can be found online](https://www.rust-lang.org/condu
* Please be kind and courteous. There's no need to be mean or rude.
* Respect that people have differences of opinion and that every design or implementation choice carries a trade-off and numerous costs. There is seldom a right answer.
* Please keep unstructured critique to a minimum. If you have solid ideas you want to experiment with, make a fork and see how it works.
* We will exclude you from interaction if you insult, demean or harass anyone. That is not welcome behavior. We interpret the term "harassment" as including the definition in the <a href="http://citizencodeofconduct.org/">Citizen Code of Conduct</a>; if you have any lack of clarity about what might be included in that concept, please read their definition. In particular, we don't tolerate behavior that excludes people in socially marginalized groups.
* We will exclude you from interaction if you insult, demean or harass anyone. That is not welcome behavior. We interpret the term "harassment" as including the definition in the <a href="https://github.com/stumpsyn/policies/blob/master/citizen_code_of_conduct.md/">Citizen Code of Conduct</a>; if you have any lack of clarity about what might be included in that concept, please read their definition. In particular, we don't tolerate behavior that excludes people in socially marginalized groups.
* Private harassment is also unacceptable. No matter who you are, if you feel you have been or are being harassed or made uncomfortable by a community member, please contact one of the channel ops or any of the [Rust moderation team][mod_team] immediately. Whether you're a regular contributor or a newcomer, we care about making this community a safe place for you and we've got your back.
* Likewise any spamming, trolling, flaming, baiting or other attention-stealing behavior is not welcome.

Expand Down
Loading
Loading