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 6 pull requests #128469

Merged
merged 15 commits into from
Aug 1, 2024
Merged

Rollup of 6 pull requests #128469

merged 15 commits into from
Aug 1, 2024

Conversation

matthiaskrgr
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

heiher and others added 15 commits July 28, 2024 12:46
std: implement the `once_wait` feature

Tracking issue: rust-lang#127527

This additionally adds a `wait_force` method to `Once` that doesn't panic on poison.

I also took the opportunity and cleaned up up the code of the queue-based implementation a bit.
Cleanup sys module to match house style

This moves a test file out of sys as it's just testing std types. Also cleans up some assorted bits including making the `use` statements match the house style.
Update target-spec metadata for loongarch64 targets
… r=fmease

Properly mark loop as diverging if it has no breaks

Due to specifics about the desugaring of the `.await` operator, HIR typeck doesn't recognize that `.await`ing an `impl Future<Output = !>` will diverge in the same way as calling a `fn() -> !`.

This is because the await operator desugars to approximately:

```rust
loop {
    match future.poll(...) {
        Poll::Ready(x) => break x,
        Poll::Pending => {}
    }
}
```

We know that the value of `x` is `!`, however since `break` is a coercion site, we coerce `!` to some `?0` (the type of the loop expression). Then since the type of the `loop {...}` expression is `?0`, we will not detect the loop as diverging like we do with other expressions that evaluate to `!`:

https://github.com/rust-lang/rust/blob/0b5eb7ba7bd796fb39c8bb6acd9ef6c140f28b65/compiler/rustc_hir_typeck/src/expr.rs#L240-L243

We can technically fix this in two ways:
1. Make coercion of loop exprs more eagerly result in a type of `!` when the only break expressions have type `!`.
2. Make loops understand that all of that if they have only diverging break values, then the loop diverges as well.

(1.) likely has negative effects on inference, and seems like a weird special case to drill into coercion. However, it turns out that (2.) is very easy to implement, we already record whether a loop has any break expressions, and when we do so, we actually skip over any break expressions with diverging values!:

https://github.com/rust-lang/rust/blob/0b5eb7ba7bd796fb39c8bb6acd9ef6c140f28b65/compiler/rustc_hir_typeck/src/expr.rs#L713-L716

Thus, we can consider the loop as diverging if we see that it has no breaks, which is the change implemented in this PR.

This is not usually a problem in regular code for two reasons:
1. In regular code, we already mark `break diverging()` as unreachable if `diverging()` is unreachable. We don't do this for `.await`, since we suppress unreachable errors within `.await` (rust-lang#64930). Un-suppressing this code will result in spurious unreachable expression errors pointing to internal await machinery.
3. In loops that truly have no breaks (e.g. `loop {}`), we already evaluate the type of the loop to `!`, so this special case is kinda moot. This only affects loops that have `break`s with values of type `!`.

Thus, this seems like a change that may affect more code than just `.await`, but it likely does not in meaningful ways; if it does, it's certainly correct to apply.

Fixes rust-lang#128434
… r=compiler-errors

Temporarily switch `ambiguous_negative_literals` lint to allow

This PR temporarily switch the `ambiguous_negative_literals` lint to `allow-by-default`, as asked by T-lang in rust-lang#128287 (comment).
…-maybe-sized, r=compiler-errors

derive(SmartPointer): require pointee to be maybe sized

cc ``@Darksonn``

So `#[pointee]` has to be `?Sized` in order for deriving `SmartPointer` to be meaningful.

cc ``@compiler-errors`` for suggestions in rust-lang#127681
@rustbot rustbot added O-windows Operating system: Windows S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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. rollup A PR which is a rollup labels Jul 31, 2024
@matthiaskrgr
Copy link
Member Author

@bors r+ rollup=never p=6

@bors
Copy link
Contributor

bors commented Jul 31, 2024

📌 Commit cf900ab has been approved by matthiaskrgr

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 Jul 31, 2024
@bors
Copy link
Contributor

bors commented Aug 1, 2024

⌛ Testing commit cf900ab with merge 71b2116...

@bors
Copy link
Contributor

bors commented Aug 1, 2024

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

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 1, 2024
@bors bors merged commit 71b2116 into rust-lang:master Aug 1, 2024
7 checks passed
@rustbot rustbot added this to the 1.82.0 milestone Aug 1, 2024
@rust-timer
Copy link
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#127567 std: implement the once_wait feature 57512b0b69bb4927a61121b8393a7185dcfeee83 (link)
#128162 Cleanup sys module to match house style bc5097913ba52fb9ead15ad0a6ba0b44facfe33d (link)
#128296 Update target-spec metadata for loongarch64 targets f603125b1c155660ee9c299617a7c2167a80f4cc (link)
#128443 Properly mark loop as diverging if it has no breaks ffc0e2e4daf197adc9794a3635ffa2e29f1997ac (link)
#128449 Temporarily switch ambiguous_negative_literals lint to al… bef9b19d4c385676af7fa9cf139f44a5177e581e (link)
#128452 derive(SmartPointer): require pointee to be maybe sized 3c22319dfb4ae6966942213ba6d61d939d92376a (link)

previous master: 28a58f2fa7

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 (71b2116): comparison URL.

Overall result: ❌ regressions - 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.

mean range count
Regressions ❌
(primary)
0.3% [0.2%, 0.7%] 10
Regressions ❌
(secondary)
1.0% [0.2%, 2.1%] 36
Improvements ✅
(primary)
-0.2% [-0.2%, -0.2%] 1
Improvements ✅
(secondary)
-2.5% [-2.5%, -2.5%] 1
All ❌✅ (primary) 0.3% [-0.2%, 0.7%] 11

Max RSS (memory usage)

Results (primary 6.3%, secondary 3.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.

mean range count
Regressions ❌
(primary)
6.3% [6.3%, 6.3%] 1
Regressions ❌
(secondary)
3.1% [3.1%, 3.1%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 6.3% [6.3%, 6.3%] 1

Cycles

Results (secondary 6.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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
6.1% [3.2%, 10.0%] 5
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

Results (primary -0.1%, 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.1% [0.1%, 0.3%] 9
Regressions ❌
(secondary)
0.1% [0.0%, 0.2%] 36
Improvements ✅
(primary)
-0.2% [-0.3%, -0.0%] 18
Improvements ✅
(secondary)
-0.9% [-0.9%, -0.9%] 3
All ❌✅ (primary) -0.1% [-0.3%, 0.3%] 27

Bootstrap: 757.595s -> 758.318s (0.10%)
Artifact size: 336.69 MiB -> 336.85 MiB (0.05%)

@rustbot rustbot added the perf-regression Performance regression. label Aug 1, 2024
@Kobzol
Copy link
Contributor

Kobzol commented Aug 6, 2024

The regression was caused by #128443. It was later resolved by #128544.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Aug 6, 2024
@matthiaskrgr matthiaskrgr deleted the rollup-00svite branch September 1, 2024 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. O-windows Operating system: Windows 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-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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.