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

Convert rustfmt from a submodule to a subtree #82208

Merged
merged 4,926 commits into from
May 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
4926 commits
Select commit Hold shift + click to select a range
7926851
stop to strip 'impl' from impl trait type alias (#3816)
rchaser53 Oct 4, 2019
fb01dc8
do not force comments to be indented with a comment trailing a line o…
scampi Oct 4, 2019
383306e
Update rustc-ap-* crates to 606.0.0 (#3835)
topecongiro Oct 5, 2019
ed697c9
fix: support raw prefix identifiers in statics
calebcartwright Oct 5, 2019
61f972b
Merge pull request #3838 from calebcartwright/static-raw-ident-prefix
scampi Oct 6, 2019
ba4bf03
don't fail on recoverable parser errors in ignored files (#3782)
calebcartwright Oct 7, 2019
e53e0f8
Cargo update
topecongiro Oct 7, 2019
2934ec5
Update CHANGELOG.md
topecongiro Oct 7, 2019
33e3667
Release v1.4.9
topecongiro Oct 7, 2019
160c3aa
handle hard tabs when formatting trailing comments (#3836)
scampi Oct 7, 2019
8073244
improve detection of URL inside a string that is being rewritten. (#3…
scampi Oct 7, 2019
6dcbc5d
fix: handle block comments with trailing line comments (#3842)
calebcartwright Oct 8, 2019
207a58f
fix panic on closure with empty block expr (#3846)
calebcartwright Oct 8, 2019
396a2af
fix to swallow attribute on brace expression (#3848)
rchaser53 Oct 10, 2019
8210cc1
fix: handle lhs unary in range expression (#3855)
calebcartwright Oct 11, 2019
a15e97f
do not indent impl generics (#3856)
scampi Oct 11, 2019
28be779
fix: nested comments in control flow condition pat
calebcartwright Oct 18, 2019
fd6e960
fix: comments between lhs and rhs
calebcartwright Oct 18, 2019
0497a7d
bump rustc-ap crates (#3870)
RalfJung Oct 19, 2019
a5d16df
feat: use offline by default with cargo fmt (#3830)
calebcartwright Oct 19, 2019
5327c36
handle field attributes when aligning a struct's fields (#3513)
scampi Oct 19, 2019
3a073f1
fix: handling of newline_style conflicts (#3850)
calebcartwright Oct 19, 2019
69c7dbc
Try to solve issue3456. (#3556)
xiongmao86 Oct 19, 2019
233497a
fix Unparsable code when formmating (#3883)
rchaser53 Oct 24, 2019
69cf483
fix handling of nested comments in patterns and ControlFlows (#3869)
topecongiro Oct 25, 2019
99f9f57
Return an error if `--check` or `--emit json` are used with stdin. (#…
jugglerchris Oct 25, 2019
d5b1832
Cargo update
topecongiro Oct 25, 2019
e47aae7
Release v1.4.10
topecongiro Oct 25, 2019
731f155
Do not add block around async closure (#3946)
topecongiro Dec 2, 2019
1838235
Release v1.4.11
topecongiro Dec 2, 2019
c60416e
deps: update rustc-ap to v642.0.0
calebcartwright Feb 9, 2020
e72f307
fix: backport parse bug fix
calebcartwright Feb 9, 2020
760bb29
chore: fix compile warnings
calebcartwright Feb 9, 2020
9f53665
rustfmt 1.x bump rustc-ap to v642 (#4043)
topecongiro Feb 10, 2020
7a76ec0
deps: bump to rustc v644
calebcartwright Mar 26, 2020
9699c96
deps: bump to rustc v647
calebcartwright Mar 26, 2020
bd5dff4
refactor: backport syntux mod
calebcartwright Mar 27, 2020
9b0ed57
refactor: parse & mod resolver for rustc-ap v650
calebcartwright Mar 27, 2020
bea7209
chore: fix src formatting
calebcartwright Mar 28, 2020
537d746
fix: use correct ForeignItem span
calebcartwright Mar 28, 2020
c1a66e1
fix: unreachable err on Fn with `None` block
calebcartwright Mar 28, 2020
b173b42
refactor: rename libsyntax --> rustc_ast
calebcartwright Mar 28, 2020
ac2d5b8
deps: bump rustc-ap* to v651
calebcartwright Mar 30, 2020
9714a14
refactor: use ast::attr:HasAttrs
calebcartwright Mar 30, 2020
5ca3d02
Merge pull request #4100 from calebcartwright/rustfmt1x-rustc-v650
Manishearth Mar 30, 2020
00e199c
backport new syntax to rustfmt 1.x (#4105)
calebcartwright Mar 31, 2020
c126730
fix: formatting arbitrary extern abi (#4089)
calebcartwright Mar 31, 2020
ca4eba5
Bump rustc-ap* crates to 654.0.0 (#4121)
topecongiro Apr 14, 2020
a5cb5d2
Release v1.4.14
topecongiro Apr 14, 2020
577ef81
Update rustc-ap-* crates to 659.0.0 for rustfmt-1.4.15 (#4184)
topecongiro May 19, 2020
770ad7b
Cargo update
topecongiro May 19, 2020
aedff61
Release v1.4.15
topecongiro May 19, 2020
08776ef
Support module-level rustfmt::skip in sub-modules
topecongiro Jun 8, 2020
ef1bb58
Bump parking_lot
topecongiro Jun 8, 2020
de8238c
Release v1.4.17
topecongiro Jun 8, 2020
de4ff81
deps: bump rustc-ap* to v664
calebcartwright Jun 11, 2020
b28fd5f
deps: apply upstream rustc-* changes
calebcartwright Jun 11, 2020
bc9a0b2
Switch to std::error::Error for errors (#3948)
dtolnay Dec 3, 2019
dead3a8
fix: backport mod resolution error handling
calebcartwright Jun 12, 2020
ce1a3ef
fix: backport fix for submod parser errors
calebcartwright Jun 12, 2020
0767a09
deps: bump structopt (and proc-macro-error)
calebcartwright Jun 12, 2020
5db7152
fix: backport fix for #4020
calebcartwright Jun 12, 2020
796d6ea
fix: backport fix for #4079
calebcartwright Jun 12, 2020
4d36560
Merge pull request #4253 from calebcartwright/rustfmt-1.4.18
topecongiro Jun 13, 2020
c1e9b7b
Release v1.4.18
topecongiro Jun 13, 2020
a36e7c7
Use correct span for match arms with the leading pipe and attributes …
topecongiro Dec 21, 2019
da18032
deps: bump rustc-ap* to v666
calebcartwright Jun 27, 2020
b243075
deps: bump rustc-ap-* to v668
calebcartwright Jul 10, 2020
391cd3e
deps: bump rustc-ap to v669
calebcartwright Jul 15, 2020
bf359c6
chore: backport 8157a3f0afe978d3e953420577f8344db7e905bf
calebcartwright Jul 15, 2020
cef1c0d
preparation for potential rustfmt 1.4.19 (#4283)
topecongiro Jul 21, 2020
a88f028
deps: bump rustc-ap to v671 (#4356)
calebcartwright Aug 7, 2020
a178031
fix: inverted span on attrs within closure
calebcartwright Aug 9, 2020
48f6c32
tests: add system tests for inverted span issue
calebcartwright Aug 9, 2020
e4617e0
deps: bump rustc-ap to v672
calebcartwright Sep 2, 2020
637ddfb
deps: bump rustc-ap to v673
calebcartwright Sep 2, 2020
d00849e
deps: bump rustc-ap to v677
calebcartwright Sep 2, 2020
aa11c27
chore: run rustfmt
calebcartwright Sep 2, 2020
89b7f5f
Fix module resolution in inner modules with paths (#4194)
mahkoh May 22, 2020
62dc7c5
fix: inner attribute formatting
calebcartwright Sep 2, 2020
01f2ead
bump rustfmt version to v1.4.21
calebcartwright Sep 4, 2020
9ba373f
deps: bump rustc-ap to v678
calebcartwright Sep 16, 2020
8635a5c
deps: bump rustc-ap to v679
dtolnay Sep 23, 2020
146578c
Add regression test for unsafe mods
dtolnay Sep 23, 2020
4908ee1
tests: add tests for leading pipe config
calebcartwright Sep 24, 2020
f6b9625
docs: add config info for match_arm_leading_pipes
calebcartwright Sep 24, 2020
d6a220b
feat: support config. of leading match arm pipe
calebcartwright Sep 24, 2020
8eedd82
ci: backport GHA workflows
calebcartwright Sep 24, 2020
a15800a
Preserve and format type aliases in extern blocks
ayazhafiz May 9, 2020
a9b0b05
fixup! Preserve and format type aliases in extern blocks
ayazhafiz May 9, 2020
92ab76c
fixup! Preserve and format type aliases in extern blocks
ayazhafiz May 10, 2020
2a8ff20
fixup! Preserve and format type aliases in extern blocks
ayazhafiz May 10, 2020
14d53f7
Use rustfmt given by RUSTFMT env var (#4419)
dtolnay Sep 16, 2020
bdb1c44
refactor: move env/osstr imports to avoid warnings
calebcartwright Oct 4, 2020
97d0301
Release v1.4.22
calebcartwright Oct 4, 2020
d95a287
deps: bump rustc-ap to v683
calebcartwright Oct 24, 2020
c89638a
deps: update macro parsing
calebcartwright Oct 20, 2020
31cef56
feat: add initial support for ConstBlock expressions
calebcartwright Oct 20, 2020
2866634
deps: bump rustc-ap to v684
calebcartwright Oct 24, 2020
e70343a
Correctly indent skipped-over code
ayazhafiz Aug 26, 2020
6a78247
Preserve comments in empty statements (#4180)
ayazhafiz May 20, 2020
fa9d974
Fix overriding license header bug (#4488)
cmichi Oct 24, 2020
e131797
deps: bump rustc-ap to v686
calebcartwright Oct 28, 2020
9faba45
fix(parser): better unclosed delims handling
calebcartwright Oct 30, 2020
86a41bc
tests: add test for panic on new_parser_from_file
calebcartwright Sep 26, 2020
2b6226c
fix: resolve some parser related bugs
calebcartwright Sep 26, 2020
98975e1
tests: adjust some cherry-picekd tests
calebcartwright Oct 30, 2020
278e8da
Add some basic tests for `try{}` expressions
scottmcm Oct 13, 2020
15854e5
feat: v2 support for nested tuples w/o spaces
calebcartwright Oct 30, 2020
fb517f4
ci: fix asset upload workflow
calebcartwright Oct 30, 2020
ea97ec5
meta: bump rustfmt version to 1.4.23
calebcartwright Oct 30, 2020
46ab144
Don't flatten a block containing a single macro call
Aaron1011 Oct 27, 2020
1139e6e
fix: remove comment from cherry-pick that v1.x doesn't handle
calebcartwright Nov 6, 2020
ae6b40e
fix: remove ignored depr attribute which now errors
calebcartwright Nov 6, 2020
eb894d5
meta: release v1.4.24
calebcartwright Nov 6, 2020
a613c57
feat: don't insert semi in macro_rules arm body
calebcartwright Nov 11, 2020
0f29ff6
meta: release v1.4.25
calebcartwright Nov 11, 2020
dd32de7
fixup! Correctly create artificial span for formatting closure body
ayazhafiz Aug 15, 2020
ce13ff1
Correctly create artificial span for formatting closure body
ayazhafiz Aug 15, 2020
faf97a6
Fixed 'Incorrect comment indent inside if/else' issue. (#4459)
whizsid Oct 15, 2020
eed826f
tests: attributed comment-only blocks
calebcartwright Nov 14, 2020
77c8c90
ci: restrict GHA workflow triggers on push
calebcartwright Nov 14, 2020
293d7d0
meta: bump version to v1.4.26
calebcartwright Nov 14, 2020
89f3830
fix: don't drop leading comments in extern
calebcartwright Nov 16, 2020
d003e3b
ci: update GHA workflows
calebcartwright Nov 16, 2020
580d826
meta: bump to v1.4.27
calebcartwright Nov 16, 2020
073cc38
Option to create groups for std, external crates, and other imports
MattX Nov 16, 2020
0037862
fix: don't force a newline after an empty where clause
meiomorphism Nov 25, 2020
581da52
deps: bump rustc-ap to v687
calebcartwright Nov 21, 2020
baee271
deps: bump rustc-ap crates to v691
calebcartwright Nov 28, 2020
5b21602
deps: minor rustc_ast changes for v691
calebcartwright Nov 28, 2020
4f32ce8
feat: support struct/slice destructuring
calebcartwright Nov 28, 2020
5c0673c
refactor: update cfg_if attr parsing
calebcartwright Nov 28, 2020
4d9fa00
feat: support underscore expressions
calebcartwright Nov 28, 2020
48d30a4
chore: run rustfmt against source
calebcartwright Nov 28, 2020
8e46225
Add a test
topecongiro Jun 30, 2020
5ffccbb
Properly format function signature in extern blocks
ayazhafiz Jun 30, 2020
3bf67c1
Don't drop blocks on foreign functions
ayazhafiz Jul 10, 2020
e7ecdc1
Remove `async fn` from extern block tests
dtolnay Nov 29, 2020
c77c6a4
Compare code block line indentation with config whitespace (#4166)
ayazhafiz May 10, 2020
3df383a
fixes #4115, #4029, #3898
ahl Apr 22, 2020
c735994
tests
ahl Apr 22, 2020
fb7e604
tests: backport an additional test case
calebcartwright Nov 29, 2020
5e7fb45
Pick up comments between visibility modifier and item name (#4239)
ayazhafiz Jun 8, 2020
ea712f1
fix: apply rustc-ap updates to backported commit
calebcartwright Nov 29, 2020
6455e9d
Fixed 'Comment removed between type name and =' issue (#4448)
whizsid Oct 9, 2020
b7c38c9
Fixed comment dropped between & and type issue (#4482)
whizsid Nov 3, 2020
823c4f8
fix: backport some imports for cherry-picked commit
calebcartwright Nov 29, 2020
7d9ee75
Comment between typebounds (#4474)
whizsid Oct 18, 2020
29f33eb
meta: bump to v1.4.28
calebcartwright Nov 29, 2020
96ee060
Preserve polarity on negative non-trait impl
dtolnay Dec 1, 2020
c40a8c1
Add negative impl test
dtolnay Dec 1, 2020
70ce182
meta: bump to v1.4.29
calebcartwright Dec 5, 2020
4cfb9ef
fix: don't strip nonexistent comma in derive
calebcartwright Dec 11, 2020
c536d80
Fix rewrite of closures with a return type
scampi Dec 7, 2020
0d022d0
Format error and typeof types (#4416)
topecongiro Sep 9, 2020
acd9486
meta: bump to v1.4.30
calebcartwright Dec 20, 2020
d8e0d00
ci: fix linking issue on windows gnu jobs
calebcartwright Jan 1, 2021
398d2f9
Add support for edition 2021.
m-ou-se Jan 1, 2021
4644418
Fixes for new rustc changes.
m-ou-se Jan 1, 2021
a6b0c18
Bump rustc-ap to v697.
m-ou-se Jan 1, 2021
5bb17a0
Account for new ast::GenericParamKind::Const::default in rust_ast.
m-ou-se Jan 1, 2021
b623eb3
Fix expected macro formatting test output.
m-ou-se Jan 1, 2021
f0eaaed
Add 2021 test.
m-ou-se Jan 2, 2021
c59b147
Update Cargo.lock.
m-ou-se Jan 2, 2021
3571c5d
fix: maintain redundant semis on items in statement pos
calebcartwright Jan 9, 2021
b57469d
ci: add mingw to path for asset upload job
calebcartwright Jan 9, 2021
4f9c794
meta: bump to v1.4.31
calebcartwright Jan 9, 2021
b30cb24
fix: indentation issue on generic bounds
calebcartwright Jan 12, 2021
c4d551c
refactor: remove unneeded clone
calebcartwright Jan 12, 2021
590f6a1
meta: update license years
calebcartwright Jan 16, 2021
216a643
meta: bump version v1.4.32
calebcartwright Jan 16, 2021
7186375
Rename `merge_imports` to `imports_granularity` and add a `Module` op…
goffrie Dec 16, 2020
0d60a61
Disable deprecated_option_merge_imports tests on non-nightly
goffrie Jan 10, 2021
17bad2b
Tweak imports_granularity documentation
goffrie Jan 13, 2021
2695846
Include constness in impl blocks (#4215)
ayazhafiz May 31, 2020
c0fede3
Use the span after generics and where clause (#4208)
topecongiro May 27, 2020
152ccb5
Do not duplicate const keyword on parameters
topecongiro Jun 30, 2020
f8deed3
Include const generic type bounds in their spans
ayazhafiz Jul 7, 2020
1102714
chore: update Changelog with const generic backports
calebcartwright Jan 27, 2021
5e14f76
fix: Avoid incorrect global 'cfg_if' Symbol interning
smklein Jan 19, 2021
384ba68
Add imports_granularity="Item".
msmorgan Jan 12, 2021
1e2b0b7
Added 4646 test case
vallentin Jan 17, 2021
3e61326
Fixed semicolon getting moved into comment (fixes #4646)
vallentin Jan 17, 2021
bd4dc36
refactor: cleanup block check for statements
calebcartwright Jan 7, 2021
c13d245
chore: backport some empty block check fixes
calebcartwright Jan 28, 2021
f0fe48f
meta: bump to v1.4.33
calebcartwright Jan 28, 2021
d80a42f
tests: add case for issue 4675
calebcartwright Jan 29, 2021
b8f318c
fix: don't insert trailing comma on struct lit rest in mac def
calebcartwright Jan 29, 2021
ea268b9
meta: bump to v1.4.34
calebcartwright Jan 29, 2021
ead937b
Add arch name to archive files created in the upload workflow (#4679)
autarch Feb 3, 2021
58ac85b
deps: bump rustc-ap crates to v701.0.0
calebcartwright Jan 31, 2021
7db2ba8
deps: bump rustc-ap to v702
calebcartwright Feb 3, 2021
82a6528
chore: bump toolchain file
calebcartwright Feb 3, 2021
55d2620
meta: bump version to v1.4.35
calebcartwright Feb 4, 2021
67faa61
deps: bump rustc-ap crates to v705
calebcartwright Feb 6, 2021
b80fdf2
chore: bump rust toolchain version
calebcartwright Feb 6, 2021
9ed7511
deps: apply rustc-ap v705 changes to itemkind variants
calebcartwright Feb 6, 2021
7de6968
meta: bump to v1.4.36
calebcartwright Feb 7, 2021
6b64e30
Bump rustc-ap-* crates to version 706
thomaseizinger Feb 11, 2021
6170948
Fix warnings
jyn514 Feb 17, 2021
4b0ed96
Fix for issue 4603 about extra macro body indentation (third version)
davidBar-On Feb 16, 2021
432e09e
Add the use of rewrite_assign_rhs_with_comments to 1.x
davidBar-On Jan 8, 2021
c3a5111
Fix some clippy warnings
jyn514 Feb 17, 2021
ca4e9f4
Fix a `legacy_derive_helpers` warning
JohnTitor Mar 18, 2021
c5c348c
deps: bump rustc-ap crates to v708
calebcartwright Mar 14, 2021
cbd83b8
chore: add span creation util function
calebcartwright Mar 14, 2021
2c63395
chore: apply pattern parsing changes
calebcartwright Mar 14, 2021
612e8d5
refactor: apply rustc mod parsing changes
calebcartwright Mar 28, 2021
83cbdf6
deps: bump rustc-ap crates to v709
calebcartwright Mar 14, 2021
a1dc57a
chore: apply AST HasAttrs->AstLike changes
calebcartwright Mar 14, 2021
f2bc4b5
deps: bump rustc-ap crates to v710
calebcartwright Mar 16, 2021
4c617e8
deps: apply rustc module loading changes
calebcartwright Mar 16, 2021
884cdb8
deps: bump rustc-ap crates to v711
calebcartwright Mar 17, 2021
bf1e47f
chore: bump toolchain
calebcartwright Mar 17, 2021
748e595
deps: remove unused rustc_attr crate AP crate
calebcartwright Mar 28, 2021
ef57c5b
chore: bump rustc-ap crates to v712
calebcartwright Mar 27, 2021
4948911
deps: apply rustc-ap-* v712 changes
calebcartwright Mar 27, 2021
c32f2ec
chore: fmt and cleanup
calebcartwright Mar 28, 2021
01cdc15
chore: bump toolchain
calebcartwright Mar 27, 2021
0bd2b19
chore: bump version and changelog
calebcartwright Apr 3, 2021
6767c1d
Don't show CRLF tests as modified in the working directory
jyn514 Feb 17, 2021
61ee108
Use `rustc_private` instead of crates.io dependencies
jyn514 Feb 17, 2021
943b97c
Fix errors when `parallel_compiler` is enabled
jyn514 Feb 17, 2021
26fb3fa
Use rustup in CI to automatically determine the toolchain version needed
jyn514 Feb 17, 2021
0269eb1
docs: update configuration info
calebcartwright Feb 23, 2020
ea1611c
feat(config): expose all width heurstic options
calebcartwright Feb 23, 2020
1bcc1f8
refactor: apply heuristic config changes in lib
calebcartwright Feb 23, 2020
a168d92
tests: augment heuristics tests
calebcartwright Feb 23, 2020
78b0728
refactor: remove panics on misconfigured widths
calebcartwright Apr 18, 2020
58157bb
Add some basic tests for chain_width use
ctz Apr 2, 2021
dac2423
Recognize when a block comment has been ended inside a string literal…
ChinYing-Li Apr 12, 2021
84ff001
Add the case in duplicate issue (#4806) to the idempotent tests
ChinYing-Li Apr 21, 2021
ddb224a
Upgrade `annotate-snippets` to 0.8 (#4762)
JohnTitor Apr 22, 2021
f874147
fix: backport changes for latest rustc api comaptibility
calebcartwright May 2, 2021
2a3635d
tests: remove snippets with inner attrs on non-block expressions
calebcartwright May 4, 2021
8526ace
Rename span_to_string to span_to_diagnostic_string
cbeuw May 4, 2021
e4b5621
Only deal with LocalPath in conversion
cbeuw May 4, 2021
ef31361
Rename `RealFileName::Named` to `LocalPath`
cbeuw May 4, 2021
927561a
Bump nightly version
cbeuw May 12, 2021
7872306
chore: update gitattributes for files with windows style line endings
calebcartwright May 14, 2021
0e61f62
add rustfmt crlf files to root gitattributes
calebcartwright May 15, 2021
e659b6d
Delete rustfmt submodule
jyn514 May 5, 2021
b2d45c0
Add 'src/tools/rustfmt/' from commit '7872306edf2e11a69aaffb9434088fd…
calebcartwright May 15, 2021
956e0ba
Update bootstrap for in-tree rustfmt
jyn514 Feb 17, 2021
b349437
Don't copy tool dependencies to the sysroot
jyn514 May 2, 2021
079d1c4
Update log to 0.4.14
jyn514 May 2, 2021
56fa9b4
Run toolstate jobs when src/tools/rustfmt is modified.
jyn514 May 5, 2021
08c7c61
should-skip-this: Check for changes between the master branch, not th…
jyn514 May 5, 2021
34368ec
ci(should-skip-this): only check commits when skip rule enabled
calebcartwright May 11, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 8 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,11 @@ config.toml.example linguist-language=TOML
*.ico binary
*.woff binary
*.woff2 binary

# Needed as part of converting rustfmt to a subtree, can hopefully be removed later.
src/tools/rustfmt/tests/source/issue-3494/crlf.rs -text
src/tools/rustfmt/tests/source/comment_crlf_newline.rs -text
src/tools/rustfmt/tests/source/configs/enum_discrim_align_threshold/40.rs -text
src/tools/rustfmt/tests/target/issue-3494/crlf.rs -text
src/tools/rustfmt/tests/target/comment_crlf_newline.rs -text
src/tools/rustfmt/tests/target/configs/enum_discrim_align_threshold/40.rs -text
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
[submodule "src/tools/rls"]
path = src/tools/rls
url = https://github.com/rust-lang/rls.git
[submodule "src/tools/rustfmt"]
path = src/tools/rustfmt
url = https://github.com/rust-lang/rustfmt.git
[submodule "src/tools/miri"]
path = src/tools/miri
url = https://github.com/rust-lang/miri.git
Expand Down
6 changes: 3 additions & 3 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1985,11 +1985,11 @@ dependencies = [

[[package]]
name = "log"
version = "0.4.11"
version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
dependencies = [
"cfg-if 0.1.10",
"cfg-if 1.0.0",
]

[[package]]
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ impl<'a> Builder<'a> {
check::Clippy,
check::Miri,
check::Rls,
check::Rustfmt,
check::Bootstrap
),
Kind::Test => describe!(
Expand Down
7 changes: 2 additions & 5 deletions src/bootstrap/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,6 @@ macro_rules! tool_check_step {
true,
);

let libdir = builder.sysroot_libdir(compiler, target);
let hostdir = builder.sysroot_libdir(compiler, compiler.host);
add_to_sysroot(&builder, &libdir, &hostdir, &stamp(builder, compiler, target));

/// Cargo's output path in a given stage, compiled by a particular
/// compiler for the specified target.
fn stamp(
Expand All @@ -363,13 +359,14 @@ macro_rules! tool_check_step {
}

tool_check_step!(Rustdoc, "src/tools/rustdoc", "src/librustdoc", SourceType::InTree);
// Clippy is a hybrid. It is an external tool, but uses a git subtree instead
// Clippy and Rustfmt are hybrids. They are external tools, but use a git subtree instead
// of a submodule. Since the SourceType only drives the deny-warnings
// behavior, treat it as in-tree so that any new warnings in clippy will be
// rejected.
tool_check_step!(Clippy, "src/tools/clippy", SourceType::InTree);
tool_check_step!(Miri, "src/tools/miri", SourceType::Submodule);
tool_check_step!(Rls, "src/tools/rls", SourceType::Submodule);
tool_check_step!(Rustfmt, "src/tools/rustfmt", SourceType::InTree);

tool_check_step!(Bootstrap, "src/bootstrap", SourceType::InTree, false);

Expand Down
16 changes: 4 additions & 12 deletions src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,15 +319,9 @@ impl Step for Rustfmt {
let host = self.host;
let compiler = builder.compiler(stage, host);

let build_result = builder.ensure(tool::Rustfmt {
compiler,
target: self.host,
extra_features: Vec::new(),
});
if build_result.is_none() {
eprintln!("failed to test rustfmt: could not build");
return;
}
builder
.ensure(tool::Rustfmt { compiler, target: self.host, extra_features: Vec::new() })
.expect("in-tree tool");

let mut cargo = tool::prepare_tool_cargo(
builder,
Expand All @@ -346,9 +340,7 @@ impl Step for Rustfmt {

cargo.add_rustc_lib_path(builder, compiler);

if try_run(builder, &mut cargo.into()) {
builder.save_toolstate("rustfmt", ToolState::TestPass);
}
builder.run(&mut cargo.into());
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ macro_rules! tool_extended {
// Note: tools need to be also added to `Builder::get_step_descriptions` in `builder.rs`
// to make `./x.py build <tool>` work.
tool_extended!((self, builder),
Cargofmt, rustfmt, "src/tools/rustfmt", "cargo-fmt", stable=true, {};
Cargofmt, rustfmt, "src/tools/rustfmt", "cargo-fmt", stable=true, in_tree=true, {};
CargoClippy, clippy, "src/tools/clippy", "cargo-clippy", stable=true, in_tree=true, {};
Clippy, clippy, "src/tools/clippy", "clippy-driver", stable=true, in_tree=true, {};
Miri, miri, "src/tools/miri", "miri", stable=false, {};
Expand All @@ -740,7 +740,7 @@ tool_extended!((self, builder),
self.extra_features.push("clippy".to_owned());
};
RustDemangler, rust_demangler, "src/tools/rust-demangler", "rust-demangler", stable=false, in_tree=true, {};
Rustfmt, rustfmt, "src/tools/rustfmt", "rustfmt", stable=true, {};
Rustfmt, rustfmt, "src/tools/rustfmt", "rustfmt", stable=true, in_tree=true, {};
RustAnalyzer, rust_analyzer, "src/tools/rust-analyzer/crates/rust-analyzer", "rust-analyzer", stable=false, {};
);

Expand Down
8 changes: 3 additions & 5 deletions src/bootstrap/toolstate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ static STABLE_TOOLS: &[(&str, &str)] = &[
("rust-by-example", "src/doc/rust-by-example"),
("edition-guide", "src/doc/edition-guide"),
("rls", "src/tools/rls"),
("rustfmt", "src/tools/rustfmt"),
];

// These tools are permitted to not build on the beta/stable channels.
Expand Down Expand Up @@ -278,10 +277,9 @@ impl Builder<'_> {
if self.config.dry_run {
return;
}
// Toolstate isn't tracked for clippy, but since most tools do, we avoid
// checking in all the places we could save toolstate and just do so
// here.
if tool == "clippy-driver" {
// Toolstate isn't tracked for clippy or rustfmt, but since most tools do, we avoid checking
// in all the places we could save toolstate and just do so here.
if tool == "clippy-driver" || tool == "rustfmt" {
return;
}
if let Some(ref path) = self.config.save_toolstates {
Expand Down
2 changes: 1 addition & 1 deletion src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ python3 "$X_PY" test --stage 2 --no-fail-fast \
src/doc/embedded-book \
src/doc/edition-guide \
src/tools/rls \
src/tools/rustfmt \
src/tools/miri \

set -e
Expand All @@ -24,3 +23,4 @@ set -e
cat /tmp/toolstate/toolstates.json
python3 "$X_PY" test --stage 2 check-tools
python3 "$X_PY" test --stage 2 src/tools/clippy
python3 "$X_PY" test --stage 2 src/tools/rustfmt
18 changes: 13 additions & 5 deletions src/ci/scripts/should-skip-this.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,23 @@ source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"

if [[ -z "${CI_ONLY_WHEN_SUBMODULES_CHANGED+x}" ]]; then
echo "Executing the job since there is no skip rule in effect"
elif git diff HEAD^ | grep --quiet "^index .* 160000"; then
exit 0
fi

git fetch "https://github.com/$GITHUB_REPOSITORY" "$GITHUB_BASE_REF"
BASE_COMMIT="$(git merge-base FETCH_HEAD HEAD)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should move this after the CI_ONLY_WHEN_SUBMODULES_CHANGED check - it looks like GITHUB_BASE_REF won't be set unless this is a PR build, which might mean this fetch either goes off and does a bunch of network traffic (increasing chance of spurious failures) or errors out.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not 100% sure how well I followed the preceding discussion but took a pass at addressing this with ea6ec11 as an additional commit

The tools job was skipped which I guess that's expected/desired given that single commit?

Please lmk if that should instead be squashed on Joshua's previous commit. Otherwise if that's fine then someone else would need to let bors know as i don't have rights

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not expect the tools job to be skipped. If anything in the PR touches those files, I would expect it to retry. I can poke around, as I don't see an obvious reason why it isn't triggering.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I see the problem. Because the script sets pipefail, and grep -q returns immediately after a match, git continues to emit output to a broken pipe which causes SIGPIPE, which causes the test to fail.

I think the solution is to remove --quiet and add 1> /dev/null 2>&1 after the grep command.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, looks like git has its own --quiet flag that could be used. I'm not certain, but I think something like this could also work (and is faster):

diff --git a/src/ci/scripts/should-skip-this.sh b/src/ci/scripts/should-skip-this.sh
index 7ce3ec18dfb..897d38440eb 100755
--- a/src/ci/scripts/should-skip-this.sh
+++ b/src/ci/scripts/should-skip-this.sh
@@ -37,7 +37,7 @@ if git diff "$BASE_COMMIT" | grep --quiet "^index .* 160000"; then
     # Submodules pseudo-files inside git have the 160000 permissions, so when
     # those files are present in the diff a submodule was updated.
     echo "Executing the job since submodules are updated"
-elif git diff --name-only "$BASE_COMMIT" | grep --quiet src/tools/'\(clippy\|rustfmt\)'; then
+elif ! git diff --quiet "$BASE_COMMIT" -- src/tools/clippy src/tools/rustfmt; then
     # There is not an easy blanket search for subtrees. For now, manually list
     # the subtrees.
     echo "Executing the job since clippy or rustfmt subtree was updated"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the former seems to have sorted things but happy to switch to the latter if that's preferable

edit: or the latter since it's more amenable to the tidy check


echo "Searching for toolstate changes between $BASE_COMMIT and $(git rev-parse HEAD)"

if git diff "$BASE_COMMIT" | grep --quiet "^index .* 160000"; then
# Submodules pseudo-files inside git have the 160000 permissions, so when
# those files are present in the diff a submodule was updated.
echo "Executing the job since submodules are updated"
elif git diff --name-only HEAD^ | grep --quiet src/tools/clippy; then
elif ! git diff --quiet "$BASE_COMMIT" -- src/tools/clippy src/tools/rustfmt; then
# There is not an easy blanket search for subtrees. For now, manually list
# clippy.
echo "Executing the job since clippy subtree was updated"
# the subtrees.
echo "Executing the job since clippy or rustfmt subtree was updated"
else
echo "Not executing this job since no submodules were updated"
echo "Not executing this job since no submodules nor subtrees were updated"
ciCommandSetEnv SKIP_JOB 1
fi
1 change: 0 additions & 1 deletion src/tools/rustfmt
Submodule rustfmt deleted from 2a3635
26 changes: 26 additions & 0 deletions src/tools/rustfmt/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[*.rs]
indent_size = 4

[tests/**/*.rs]
charset = utf-8
end_of_line = unset
indent_size = unset
indent_style = unset
trim_trailing_whitespace = unset
insert_final_newline = unset

[appveyor.yml]
end_of_line = unset
7 changes: 7 additions & 0 deletions src/tools/rustfmt/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
* text=auto eol=lf
tests/source/issue-3494/crlf.rs -text
tests/source/comment_crlf_newline.rs -text
tests/source/configs/enum_discrim_align_threshold/40.rs -text
tests/target/issue-3494/crlf.rs -text
tests/target/comment_crlf_newline.rs -text
tests/target/configs/enum_discrim_align_threshold/40.rs -text
85 changes: 85 additions & 0 deletions src/tools/rustfmt/.github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: integration
on:
push:
branches:
- master
pull_request:

jobs:
integration-tests:
runs-on: ubuntu-latest
name: ${{ matrix.integration }}
strategy:
# https://help.github.com/en/actions/getting-started-with-github-actions/about-github-actions#usage-limits
# There's a limit of 60 concurrent jobs across all repos in the rust-lang organization.
# In order to prevent overusing too much of that 60 limit, we throttle the
# number of rustfmt jobs that will run concurrently.
max-parallel: 4
fail-fast: false
matrix:
integration: [
bitflags,
error-chain,
log,
mdbook,
packed_simd,
rust-semverver,
tempdir,
futures-rs,
rust-clippy,
failure,
]
include:
# Allowed Failures
# Actions doesn't yet support explicitly marking matrix legs as allowed failures
# https://github.community/t5/GitHub-Actions/continue-on-error-allow-failure-UI-indication/td-p/37033
# https://github.community/t5/GitHub-Actions/Why-a-matrix-step-will-be-canceled-if-another-one-failed/td-p/30920
# Instead, leverage `continue-on-error`
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepscontinue-on-error
#
# Failing due to breaking changes in rustfmt 2.0 where empty
# match blocks have trailing commas removed
# https://github.com/rust-lang/rustfmt/pull/4226
- integration: chalk
allow-failure: true
- integration: crater
allow-failure: true
- integration: glob
allow-failure: true
- integration: stdsimd
allow-failure: true
# Using old rustfmt configuration option
- integration: rand
allow-failure: true
# Keep this as an allowed failure as it's fragile to breaking changes of rustc.
- integration: rust-clippy
allow-failure: true
# Using old rustfmt configuration option
- integration: packed_simd
allow-failure: true
# calebcartwright (2019-12-24)
# Keeping this as an allowed failure since it was flagged as such in the TravisCI config, even though
# it appears to have been passing for quite some time.
# Original comment was: temporal build failure due to breaking changes in the nightly compiler
- integration: rust-semverver
allow-failure: true
# Can be moved back to include section after https://github.com/rust-lang-nursery/failure/pull/298 is merged
- integration: failure
allow-failure: true

steps:
- name: checkout
uses: actions/checkout@v2

# Run build
- name: install rustup
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup-init.sh
sh rustup-init.sh -y --default-toolchain none

- name: run integration tests
env:
INTEGRATION: ${{ matrix.integration }}
TARGET: x86_64-unknown-linux-gnu
run: ./ci/integration.sh
continue-on-error: ${{ matrix.allow-failure == true }}
42 changes: 42 additions & 0 deletions src/tools/rustfmt/.github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: linux
on:
push:
branches:
- master
pull_request:

jobs:
test:
runs-on: ubuntu-latest
name: (${{ matrix.target }}, nightly)
strategy:
# https://help.github.com/en/actions/getting-started-with-github-actions/about-github-actions#usage-limits
# There's a limit of 60 concurrent jobs across all repos in the rust-lang organization.
# In order to prevent overusing too much of that 60 limit, we throttle the
# number of rustfmt jobs that will run concurrently.
max-parallel: 1
fail-fast: false
matrix:
target: [
x86_64-unknown-linux-gnu,
]

steps:
- name: checkout
uses: actions/checkout@v2

# Run build
- name: install rustup
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup-init.sh
sh rustup-init.sh -y --default-toolchain none
rustup target add ${{ matrix.target }}

- name: build
run: |
rustc -Vv
cargo -V
cargo build

- name: test
run: cargo test
39 changes: 39 additions & 0 deletions src/tools/rustfmt/.github/workflows/mac.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: mac
on:
push:
branches:
- master
pull_request:

jobs:
test:
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/virtual-environments-for-github-hosted-runners#supported-runners-and-hardware-resources
# macOS Catalina 10.15
runs-on: macos-latest
name: (${{ matrix.target }}, nightly)
strategy:
fail-fast: false
matrix:
target: [
x86_64-apple-darwin,
]

steps:
- name: checkout
uses: actions/checkout@v2

# Run build
- name: install rustup
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup-init.sh
sh rustup-init.sh -y --default-toolchain none
rustup target add ${{ matrix.target }}

- name: build
run: |
rustc -Vv
cargo -V
cargo build

- name: test
run: cargo test