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

Sync from rustfmt #130593

Merged
merged 109 commits into from
Sep 20, 2024
Merged

Sync from rustfmt #130593

merged 109 commits into from
Sep 20, 2024

Conversation

ytmimi
Copy link
Contributor

@ytmimi ytmimi commented Sep 20, 2024

r? @ghost

compiler-errors and others added 30 commits June 17, 2024 22:35
This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle
Merge `PatParam`/`PatWithOr`, and `Expr`/`Expr2021`, for a few reasons.

- It's conceptually nice, because the two pattern kinds and the two
  expression kinds are very similar.

- With expressions in particular, there are several places where both
  expression kinds get the same treatment.

- It removes one unreachable match arm.

- Most importantly, for rust-lang#124141 I will need to introduce a new type
  `MetaVarKind` that is very similar to `NonterminalKind`, but records a
  couple of extra fields for expression metavars. It's nicer to have a
  single `MetaVarKind::Expr` expression variant to hold those extra
  fields instead of duplicating them across two variants
  `MetaVarKind::{Expr,Expr2021}`. And then it makes sense for patterns
  to be treated the same way, and for `NonterminalKind` to also be
  treated the same way.

I also clarified the comments, because I have long found them a little
hard to understand.
…r=compiler-errors

Rework pattern and expression nonterminal kinds.

Some tweaks to `NonterminalKind` that will assist with rust-lang#124141. Details in the individual commits.

r? compiler-errors
cc ```@eholk```
…ebcartwright

Implement `use<>` formatting in rustfmt

This PR implements formatting for precise-capturing `use<>` syntax as proposed in rust-lang#126753.

The syntax is implemented as-if the `use<>` bound were a trait bound but with the `use` keyword as its path segment identifier.

I opted to develop this in the rust-lang/rust tree since I'm not certain when the next rustfmt subtree sync is going to be, and I'd rather not block landing nightly support for `use<>` on something I have no control over. If ``@rust-lang/rustfmt`` would rather I move this PR over to that repository, then I would at least like to know when the next rustfmt->rust subtree sync is going to be, since stabilizing `precise_capturing` without formatting will be disruptive.

This implementation is otherwise rather straightforward.

Tracking:

- rust-lang#123432
…g, r=dtolnay

Remove stray println from rustfmt's `rewrite_static`

r? `@calebcartwright` `@ytmimi` -- though anyone should probably r+ this so it gets into nightly sooner than later, since it's obviously wrong.

This can just be fixed in-tree, since I don't think we want to wait until the next sync to fix this.

Fix rust-lang/rustfmt#6210
Fix rust-lang#126887
impl rewrite_result for ast::Local, ast::FieldDef, ast::Param, ast::FnRetTy
…-lang#6232)

This adds a test case to validate behavior when using
`format_code_in_doc_comments=true`
Makes internal changes to define each configuration in terms of the
`StyleEditionDefault` trait, and hard codes `StyleEdition::Edition2015`
anywhere the new `style_edition` is needed.

**Note** users are still unable to configure `style edition`.
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 20, 2024
@rustbot
Copy link
Collaborator

rustbot commented Sep 20, 2024

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

Some changes occurred in src/tools/rustfmt

cc @rust-lang/rustfmt

@rustbot
Copy link
Collaborator

rustbot commented Sep 20, 2024

There are merge commits (commits with multiple parents) in your changes. We have a no merge policy so these commits will need to be removed for this pull request to be merged.

You can start a rebase with the following commands:

$ # rebase
$ git pull --rebase https://github.com/rust-lang/rust.git master
$ git push --force-with-lease

The following commits are merge commits:

@rustbot rustbot added has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 20, 2024
@compiler-errors
Copy link
Member

@bors delegate+

@bors
Copy link
Contributor

bors commented Sep 20, 2024

✌️ @ytmimi, you can now approve this pull request!

If @compiler-errors told you to "r=me" after making some further change, please make that change, then do @bors r=@compiler-errors

@ytmimi
Copy link
Contributor Author

ytmimi commented Sep 20, 2024

@bors r+ p=1 rollup=never

@bors
Copy link
Contributor

bors commented Sep 20, 2024

📌 Commit eeda9dd has been approved by ytmimi

It is now in the queue for this repository.

@bors bors 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. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 20, 2024
@bors
Copy link
Contributor

bors commented Sep 20, 2024

⌛ Testing commit eeda9dd with merge 2e45ec3...

@bors
Copy link
Contributor

bors commented Sep 20, 2024

☀️ Test successful - checks-actions
Approved by: ytmimi
Pushing 2e45ec3 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 20, 2024
@bors bors merged commit 2e45ec3 into rust-lang:master Sep 20, 2024
7 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Sep 20, 2024
@ytmimi ytmimi deleted the sync-from-rustfmt branch September 20, 2024 06:18
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (2e45ec3): 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)

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

Cycles

Results (secondary -4.4%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.4% [-6.0%, -2.6%] 5
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 768.735s -> 768.024s (-0.09%)
Artifact size: 341.28 MiB -> 341.30 MiB (0.01%)

tautschnig added a commit to tautschnig/kani that referenced this pull request Sep 24, 2024
Changes required due to:
- rust-lang/rust#130593 Sync from rustfmt

With the exception of changes to `rust-toolchain.toml` and
`rustfmt.toml` all changes were automatically created by running
`scripts/kani-fmt.sh`.
github-merge-queue bot pushed a commit to model-checking/kani that referenced this pull request Sep 24, 2024
Changes required due to:
- rust-lang/rust#130593 Sync from rustfmt
- rust-lang/rust#124895 Disallow hidden
references to mutable static

With the exception of changes to `rust-toolchain.toml`, `rustfmt.toml`,
and `library/kani/src/futures.rs` all changes were automatically created
by running `scripts/kani-fmt.sh`.

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 and MIT licenses.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has-merge-commits PR has merge commits, merge with caution. merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.