Skip to content

Rollup of 15 pull requests - #129809

Merged
bors merged 34 commits into
rust-lang:masterfrom
matthiaskrgr:rollup-cyygnxh
Aug 31, 2024
Merged

Rollup of 15 pull requests#129809
bors merged 34 commits into
rust-lang:masterfrom
matthiaskrgr:rollup-cyygnxh

Conversation

@matthiaskrgr

Copy link
Copy Markdown
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

aDotInTheVoidand others added 30 commits August 15, 2024 13:07
This shouldn't affect projects indirectly depending on wasm-bindgen
because cargo passes `--cap-lints=allow` when building dependencies.
It should be 0.3.74~ish.
This should help with backtraces on Android, QNX NTO 7.0, and Windows.
Previously `libname.a` naming was supported as a fallback when producing rlibs, but not when producing executables or dynamic libraries
This commit fixes an assert in the WASI-specific implementation of
thread sleep to ensure that sleeping for a very large period of time
blocks instead of panicking. This can come up when testing programs that
sleep "forever", for example.
Several compiler functions have `Option<!>` for their return type.
That's odd. The only valid return value is `None`, so why is this type
used?
Because it lets you write certain patterns slightly more concisely. E.g.
if you have these common patterns:
```
let Some(a) = f() else { return };
let Ok(b) = g() else { return };
```
you can shorten them to these:
```
let a = f()?;
let b = g().ok()?;
```
Huh.
An `Option` return type typically designates success/failure. How should
I interpret the type signature of a function that always returns (i.e.
doesn't panic), does useful work (modifying `&mut` arguments), and yet
only ever fails? This idiom subverts the type system for a cute
syntactic trick.
Furthermore, returning `Option<!>` from a function F makes things
syntactically more convenient within F, but makes things worse at F's
callsites. The callsites can themselves use `?` with F but should not,
because they will get an unconditional early return, which is almost
certainly not desirable. Instead the return value should be ignored.
(Note that some of callsites of `process_operand`, `process_immedate`,
`process_assign` actually do use `?`, though the early return doesn't
matter in these cases because nothing of significance comes after those
calls. Ugh.)
When I first saw this pattern I had no idea how to interpret it, and it
took me several minutes of close reading to understand everything I've
written above. I even started a Zulip thread about it to make sure I
understood it properly. "Save a few characters by introducing types so
weird that compiler devs have to discuss it on Zulip" feels like a bad
trade-off to me. This commit replaces all the `Option<!>` return values
and uses `else`/`return` (or something similar) to replace the relevant
`?` uses. The result is slightly more verbose but much easier to
understand.
…-patterns, r=nnethercote
Don't make statement nonterminals match pattern nonterminals
Right now, the heuristic we use to check if a token may begin a pattern nonterminal falls back to `may_be_ident`:
https://github.com/rust-lang/rust/blob/ef71f1047e04438181d7cb925a833e2ada6ab390/compiler/rustc_parse/src/parser/nonterminal.rs#L21-L37
This has the unfortunate side effect that a `stmt` nonterminal eagerly matches against a `pat` nonterminal, leading to a parse error:
```rust
macro_rules! m {
($pat:pat) => {};
($stmt:stmt) => {};
}
macro_rules! m2 {
($stmt:stmt) => {
m! { $stmt }
};
}
m2! { let x = 1 }
```
This PR fixes it by more accurately reflecting the set of nonterminals that may begin a pattern nonterminal.
As a side-effect, I modified `Token::can_begin_pattern` to work correctly and used that in `Parser::nonterminal_may_begin_with`.
…z,notriddle
Separate core search logic with search ui
Currenty, the `search.js` mixed with UI/DOM manipulation codes and search logic codes, I propose to extract the search logic to a class for following benefits:
- Clean code. Separation of DOM manipulation and search logic can lead better code maintainability and easy code testings.
- Easy share the search logic for third party to utilize the search function, such as [Rust Search Extension](https://rust.extension.sh), https://query.rs.
This PR added a new class called `DocSearch`, which mainly expose following methods:
```js
class DocSearch {
// Dependency inject searchIndex, rootPath and searchState
constructor(rawSearchIndex, rootPath, searchState) {
// build search index...
}
static parseQuery(userQuery) {
}
async execQuery(parsedQuery, filterCrates, currentCrate) {
}
}
```
…=fmease
rustdoc-json: Add test for `Self` type
Inspired by rust-lang#128471, the rustdoc-json suite had no tests in place for the `Self` type. This PR adds one.
I've also manually checked locally that this test passes on 29e9248, confirming that adding `clean::Type::SelfTy` didn't change the JSON output. (potentially adding a self type to json (insead of (ab)using generic) is tracked in rust-lang#128522)
Updates rust-lang#81359
r? ````````@fmease````````
linker: Synchronize native library search in rustc and linker
Also search for static libraries with alternative naming (`libname.a`) on MSVC when producing executables or dynamic libraries, and not just rlibs.
This unblocks rust-lang#123436.
try-job: x86_64-msvc
Don't use `TyKind` in a lint
Allows us to remove an inherent method from `TyKind` from the type ir crate.
…fcw-to-deny, r=daxpedda,alexcrichton
Deny `wasm_c_abi` lint to nudge the last 25%
This shouldn't affect projects indirectly depending on wasm-bindgen because cargo passes `--cap-lints=allow` when building dependencies.
The motivation is that the ecosystem has mostly taken up the versions of wasm-bindgen that are compatible in general, but ~25% or so of recent downloads remain on lower versions. However, this change might still be unnecessarily disruptive. I mostly propose it as a discussion point.
…, r=tgross35
Re-enable android tests/benches in alloc/core
This is basically a revert of rust-lang#73729. These tests better work on android now; it's been 4 years and we don't use dlmalloc on that target anymore.
And I've validated that they should pass now with a try-build :)
…b22, r=workingjubilee
Bump backtrace to 0.3.74~ish
Commit: rust-lang/backtrace-rs@230570f
This should help with backtraces on Android, QNX NTO 7.0, and Windows.
It addresses a case of backtrace incurring undefined behavior on Android.
…d, r=workingjubilee
allow BufReader::peek to be called on unsized types
rust-lang#128405
…r=lcnr
Simplify some extern providers
Simplifies some extern crate providers:
1. Generalize the `ProcessQueryValue` identity impl to work on non-`Option` types.
2. Allow `ProcessQueryValue` to wrap its output in an `EarlyBinder`, to simplify `explicit_item_bounds`/`explicit_item_super_predicates`.
3. Use `{ table }` and friends more when possible.
…-dead
Remove `Option<!>` return types.
Several compiler functions have `Option<!>` for their return type. That's odd. The only valid return value is `None`, so why is this type used?
Because it lets you write certain patterns slightly more concisely. E.g. if you have these common patterns:
```
let Some(a) = f() else { return };
let Ok(b) = g() else { return };
```
you can shorten them to these:
```
let a = f()?;
let b = g().ok()?;
```
Huh.
An `Option` return type typically designates success/failure. How should I interpret the type signature of a function that always returns (i.e. doesn't panic), does useful work (modifying `&mut` arguments), and yet only ever fails? This idiom subverts the type system for a cute syntactic trick.
Furthermore, returning `Option<!>` from a function F makes things syntactically more convenient within F, but makes things worse at F's callsites. The callsites can themselves use `?` with F but should not, because they will get an unconditional early return, which is almost certainly not desirable. Instead the return value should be ignored. (Note that some of callsites of `process_operand`, `process_immedate`, `process_assign` actually do use `?`, though the early return doesn't matter in these cases because nothing of significance comes after those calls. Ugh.)
When I first saw this pattern I had no idea how to interpret it, and it took me several minutes of close reading to understand everything I've written above. I even started a Zulip thread about it to make sure I understood it properly. "Save a few characters by introducing types so weird that compiler devs have to discuss it on Zulip" feels like a bad trade-off to me. This commit replaces all the `Option<!>` return values and uses `else`/`return` (or something similar) to replace the relevant `?` uses. The result is slightly more verbose but much easier to understand.
r? ``````@cjgillot``````
@rustbotrustbot added 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 Aug 31, 2024
@matthiaskrgr

Copy link
Copy Markdown
MemberAuthor

@bors r+ rollup=never p=15

@bors

bors commented Aug 31, 2024

Copy link
Copy Markdown
Collaborator

📌 Commit 25e3b66 has been approved by matthiaskrgr

It is now in the queue for this repository.

@borsbors 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 Aug 31, 2024
@bors

bors commented Aug 31, 2024

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 25e3b66 with merge 9649706...

@matthiaskrgr

Copy link
Copy Markdown
MemberAuthor

there we go

@bors

bors commented Aug 31, 2024

Copy link
Copy Markdown
Collaborator

☀️ Test successful - checks-actions
Approved by: matthiaskrgr
Pushing 9649706 to master...

@borsbors added the merged-by-bors This PR was explicitly merged by bors. label Aug 31, 2024
@bors
bors merged commit 9649706 into rust-lang:masterAug 31, 2024
@rustbotrustbot added this to the 1.82.0 milestone Aug 31, 2024
@rust-timer

Copy link
Copy Markdown
Collaborator

📌 Perf builds for each rolled up PR:

PR#MessagePerf Build Sha
#120221Don't make statement nonterminals match pattern nonterminalsc8a538a7032ba3d35c90642bc6c47d985282af8d (link)
#126183Separate core search logic with search uic5f6a66bd472f75e77a7d9ed1ee83454b63d5057 (link)
#129123rustdoc-json: Add test for Self type52b51b8a3e8716b491fdf82c075c303f79cce65e (link)
#129366linker: Synchronize native library search in rustc and link…970b7b00bc353065c23d1e2d8e22c0a2b8260da7 (link)
#129527Don't use TyKind in a lint32892549aa22df7399226f3281b94b32cd2ec7c3 (link)
#129534Deny wasm_c_abi lint to nudge the last 25%8c930915fe4ca02780c9ff2fec9612723ca9c203 (link)
#129640Re-enable android tests/benches in alloc/core16f4069d874ebc66e07259afddae546ccb536ca1 (link)
#129642Bump backtrace to 0.3.74~ishcb6799285d407dab26843816f9b98d515eecadc9 (link)
#129675allow BufReader::peek to be called on unsized typesfc177c6c435e97b84e3d7ec9ed19870c4dfbfd3b (link)
#129723Simplify some extern providersd7b7d7deaeb75804926dc0d2529f064a1ef0d1fb (link)
#129724Remove Option<!> return types.d101b3fa61198f4a193e77477e77d95dd9889fec (link)
#129725Stop using ty::GenericPredicates for non-predicates_of qu…1b1ad99aff96a560ae4405daf63996c023f43801 (link)
#129731Allow running ./x.py test compiler702679cd9f0236ce8997c93aa01ee8c57d7a30e6 (link)
#129751interpret/visitor: make memory order iteration slightly mor…2ab629b2fff152427b0f45f5ade6c44cefe50d50 (link)
#129754wasi: Fix sleeping for Duration::MAX196534199a7aba5e0b5195084a5bf1ca72cca969 (link)

previous master: fa72f0763d

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
Copy Markdown
Collaborator

Finished benchmarking commit (9649706): comparison URL.

Overall result: ❌✅ regressions and improvements - ACTION NEEDED

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

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

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

meanrangecount
Regressions ❌
(primary)
0.3%[0.3%, 0.3%]1
Regressions ❌
(secondary)
0.9%[0.4%, 1.7%]3
Improvements ✅
(primary)
-0.5%[-2.6%, -0.2%]25
Improvements ✅
(secondary)
-0.7%[-5.9%, -0.2%]24
All ❌✅ (primary)-0.5%[-2.6%, 0.3%]26

Max RSS (memory usage)

Results (primary 0.1%, secondary -0.1%)

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.

meanrangecount
Regressions ❌
(primary)
0.8%[0.4%, 3.2%]36
Regressions ❌
(secondary)
0.8%[0.5%, 2.6%]34
Improvements ✅
(primary)
-0.9%[-3.2%, -0.4%]30
Improvements ✅
(secondary)
-0.9%[-3.8%, -0.4%]42
All ❌✅ (primary)0.1%[-3.2%, 3.2%]66

Cycles

Results (primary -0.4%, secondary -0.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.

meanrangecount
Regressions ❌
(primary)
0.7%[0.4%, 2.0%]13
Regressions ❌
(secondary)
1.0%[0.4%, 3.3%]50
Improvements ✅
(primary)
-0.8%[-4.9%, -0.4%]31
Improvements ✅
(secondary)
-1.1%[-4.2%, -0.4%]66
All ❌✅ (primary)-0.4%[-4.9%, 2.0%]44

Binary size

Results (primary 0.3%, 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.

meanrangecount
Regressions ❌
(primary)
0.3%[0.0%, 0.8%]51
Regressions ❌
(secondary)
0.0%[0.0%, 0.0%]5
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)0.3%[0.0%, 0.8%]51

Bootstrap: 789.792s -> 788.814s (-0.12%)
Artifact size: 338.69 MiB -> 338.74 MiB (0.01%)

@rustbotrustbot added the perf-regression Performance regression. label Aug 31, 2024
@matthiaskrgr
matthiaskrgr deleted the rollup-cyygnxh branch September 1, 2024 17:35
@Kobzol

Copy link
Copy Markdown
Member

The coercions improvement is noise, but the rest seems legit. More improvements than regressions, marking as triaged.

@rustbot label: +perf-regression-triaged

@rustbotrustbot added the perf-regression-triaged The performance regression has been triaged. label Sep 3, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-run-makeArea: port run-make Makefiles to rmake.rsA-rustdoc-jsonArea: Rustdoc JSON backendmerged-by-borsThis PR was explicitly merged by bors.O-wasiOperating system: Wasi, Webassembly System Interfaceperf-regressionPerformance regression.perf-regression-triagedThe performance regression has been triaged.rollupA PR which is a rollupS-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-libsRelevant to the library team, which will review and decide on the PR/issue.T-rustdocRelevant 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.

16 participants

@matthiaskrgr@bors@rust-timer@Kobzol@rustbot@aDotInTheVoid@compiler-errors@workingjubilee@petrochenkov@saethlin@Folyd@lolbinarycat@Veykril@RalfJung@alexcrichton@nnethercote