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

Rollup of 11 pull requests #134470

Merged
merged 37 commits into from
Dec 18, 2024
Merged

Rollup of 11 pull requests #134470

merged 37 commits into from
Dec 18, 2024

Conversation

jieyouxu
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

Integral-Tech and others added 30 commits December 18, 2024 00:28
As it happens, lookahead values of 0, 1, and 2 all work fine here, due
to the structure of the code. (Values or 3 or greater cause test
failures.) This commit changes the lookahead to zero because that will
facilitate cleanups in subsequent commits.
It's only ever used with a lookahead of 0, so this commit removes the
lookahead and renames it `peek`.
Because `TokenStreamIter` is a much better name for a `TokenStream`
iterator. Also rename the `TokenStream::trees` method as
`TokenStream::iter`, and some local variables.
Currently there are two ways to peek at a `TokenStreamIter`.
- Wrap it in a `Peekable` and use that traits `peek` method.
- Use `TokenStreamIter`'s inherent `peek` method.

Some code uses one, some use the other. This commit converts all places
to the inherent method. This eliminates mixing of `TokenStreamIter` and
`Peekable<TokenStreamIter>` and some use of `impl Iterator` and `dyn
Iterator`.
…ckend

Before, cg_cranelift would ICE when trying to lower f16 and f128. The
library/ crates had all the infrastructure to omit using them, it just
wasn't hooked up to bootstrap.
- Move it to `rustc_parse`, which is the only crate that uses it. This
  lets us remove all the `pub` markers from it.

- Change `next_ref` and `look_ahead` to `get` and `bump`, which work
  better for the `rustc_parse` uses.

- This requires adding a `TokenStream::get` method, which is simple.

- In `TokenCursor`, we currently duplicate the
  `DelimSpan`/`DelimSpacing`/`Delimiter` from the surrounding
  `TokenTree::Delimited` in the stack. This isn't necessary so long as
  we don't prematurely move past the `Delimited`, and is a small perf
  win on a very hot code path.

- In `parse_token_tree`, we clone the relevant `TokenTree::Delimited`
  instead of constructing an identical one from pieces.
- `LazyCell::get`: said it was returning a **mutable** reference.
- `LazyCell::get_mut`: said it was returning a reference (the mutable
  was missing).
It's a verbose reinvention of a range type, and can be cut down a lot.
`rustc_symbol` is the source of truth for keywords.

rustdoc has its own implicit definition of keywords, via the
`is_doc_keyword`. It (presumably) intends to include all keywords, but
it omits `yeet`.

rustfmt has its own explicit list of Rust keywords. It also (presumably)
intends to include all keywords, but it omits `await`, `builtin`, `gen`,
`macro_rules`, `raw`, `reuse`, `safe`, and `yeet`. Also, it does linear
searches through this list, which is inefficient.

This commit fixes all of the above problems by introducing a new
predicate `is_any_keyword` in rustc and using it in rustdoc and rustfmt.
It documents that it's not the right predicate in most cases.
`gen` is an edition-specific keyword used in unstable Rust, and so
belongs with `try` (as `is_unused_keyword_conditional` indicates).

Also, the cases in `is_unused_keyword_conditional` should be in
alphabetical order, to match the keyword list.

These changes don't affect the behaviour of any of the `Symbol::is_*`
functions.
In particular, clarify which predicates apply to which keywords.
…nup, r=oli-obk

 mir-opt: a sub-BB of a cleanup BB must also be a cleanup BB in `EarlyOtherwiseBranch`

Fixes rust-lang#130769.

r? `@cjgillot` or mir-opt
…r=lcnr

Fix const conditions for RPITITs

Fixes rust-lang#133918

r? lcnr
…, r=spastorino

Overhaul token cursors

Some nice cleanups here.

r? `````@davidtwco`````
…etrochenkov

Overhaul keyword handling

The compiler's list of keywords has some problems.
- It contains several items that aren't keywords.
- The order isn't quite right in a couple of places.
- Some of the names of predicates relating to keywords are confusing.
- rustdoc and rustfmt have their own (incorrect) versions of the keyword list.
- `AllKeywords` is unnecessarily complex.

r? ```@jieyouxu```
Fix `x build --stage 1 std` when using cg_cranelift as the default backend

Before, cg_cranelift would ICE when trying to lower f16 and f128. The library/ crates had all the infrastructure to omit using them, it just wasn't hooked up to bootstrap.

r? `````@bjorn3`````
…=tgross35

fix(LazyCell): documentation of get[_mut] was wrong

- `LazyCell::get`: said it was returning a **mutable** reference.
- `LazyCell::get_mut`: said it was returning a reference (the mutable was missing).

Related to rust-lang#129333 (`lazy_get`). `LazyLock`'s documentation was correct.
Merge some patterns together

just something I noticed while browsing code. No change in functionality, deduplicates the 100% equal match arms by creating one big or pattern
@rustbot rustbot added A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Dec 18, 2024
@jieyouxu
Copy link
Member Author

@bors r+ rollup=never p=5

@bors
Copy link
Contributor

bors commented Dec 18, 2024

📌 Commit 29d201a has been approved by jieyouxu

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. labels Dec 18, 2024
@bors
Copy link
Contributor

bors commented Dec 18, 2024

⌛ Testing commit 29d201a with merge a52085d...

@bors
Copy link
Contributor

bors commented Dec 18, 2024

☀️ Test successful - checks-actions
Approved by: jieyouxu
Pushing a52085d to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 18, 2024
@bors bors merged commit a52085d into rust-lang:master Dec 18, 2024
7 checks passed
@rustbot rustbot added this to the 1.85.0 milestone Dec 18, 2024
@rust-timer
Copy link
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#130786 mir-opt: a sub-BB of a cleanup BB must also be a cleanup B… 525aeb99dd941c6a004a2a28ae222a1e57108c4a (link)
#133926 Fix const conditions for RPITITs e4d22519009cd0649f8c8c6470a3a130088bb63f (link)
#134161 Overhaul token cursors fddffe005a8aa2b05b5a6cf42922989359384da6 (link)
#134253 Overhaul keyword handling 9a6aee041603f5acbc0de1582fce34c282f8c992 (link)
#134394 Clarify the match ergonomics 2024 migration lint's output bea1745c492d40d2b1fbc9efe314b73158bdad51 (link)
#134399 Do not do if ! else, use unnegated cond and swap the branch… 0bbe73288b2c3596ca929831b048793b2b9c212b (link)
#134420 refactor: replace &PathBuf with &Path to enhance generality 0e4832cb9be22e68f5aa2b27535a32a64159e177 (link)
#134436 tests/assembly/asm: Remove uses of rustc_attrs and lang_ite… be1dffaf07b6dae139dbe61869699517efe8ffe2 (link)
#134444 Fix x build --stage 1 std when using cg_cranelift as the … 7a8b308bb67d7bf3091568160201db85be1db608 (link)
#134452 fix(LazyCell): documentation of get[_mut] was wrong ebd1e65cbcd958e319d56a51cbc593db0a465529 (link)
#134460 Merge some patterns together 2e1b20437ef42caf7b30678212c994f3696965d0 (link)

previous master: 057bdb37ec

In the case of a perf regression, run the following command for each PR you suspect might be the cause: @rust-timer build $SHA

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (a52085d): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.2% [0.1%, 0.4%] 7
Improvements ✅
(primary)
-0.2% [-0.3%, -0.1%] 3
Improvements ✅
(secondary)
-0.5% [-0.5%, -0.3%] 5
All ❌✅ (primary) -0.2% [-0.3%, -0.1%] 3

Max RSS (memory usage)

Results (primary -0.1%, secondary 1.2%)

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.6% [0.6%, 0.6%] 1
Regressions ❌
(secondary)
2.3% [0.6%, 3.7%] 5
Improvements ✅
(primary)
-0.9% [-0.9%, -0.9%] 1
Improvements ✅
(secondary)
-3.9% [-3.9%, -3.9%] 1
All ❌✅ (primary) -0.1% [-0.9%, 0.6%] 2

Cycles

Results (secondary 1.2%)

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)
3.1% [2.1%, 5.5%] 11
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.0% [-3.6%, -2.0%] 5
All ❌✅ (primary) - - 0

Binary size

Results (secondary 0.0%)

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.0% [0.0%, 0.0%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Bootstrap: 769.67s -> 769.824s (0.02%)
Artifact size: 330.31 MiB -> 330.35 MiB (0.01%)

@rustbot rustbot added the perf-regression Performance regression. label Dec 18, 2024
@jieyouxu jieyouxu deleted the rollup-kld7kmk branch December 18, 2024 21:06
@Kobzol
Copy link
Contributor

Kobzol commented Dec 23, 2024

Regressions seem to be balanced with improvements.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.