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 7 pull requests #128186

Merged
merged 17 commits into from
Jul 25, 2024
Merged

Rollup of 7 pull requests #128186

merged 17 commits into from
Jul 25, 2024

Conversation

matthiaskrgr
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

Urgau and others added 17 commits July 11, 2024 00:46
…up or pollerr for refused connections in linux
…-errors

Implement lint against ambiguous negative literals

This PR implements a lint against ambiguous negative literals with a literal and method calls right after it.

## `ambiguous_negative_literals`

(deny-by-default)

The `ambiguous_negative_literals` lint checks for cases that are confusing between a negative literal and a negation that's not part of the literal.

### Example

```rust,compile_fail
-1i32.abs(); // equals -1, while `(-1i32).abs()` equals 1
```

### Explanation

Method calls take precedence over unary precedence. Setting the precedence explicitly makes the code clearer and avoid potential bugs.

<details>
<summary>Old proposed lint</summary>

## `ambiguous_unary_precedence`

(deny-by-default)

The `ambiguous_unary_precedence` lint checks for use the negative unary operator with a literal and method calls.

### Example

```rust
-1i32.abs(); // equals -1, while `(-1i32).abs()` equals 1
```

### Explanation

Unary operations take precedence on binary operations and method calls take precedence over unary precedence. Setting the precedence explicitly makes the code clearer and avoid potential bugs.

</details>

-----

Note: This is a strip down version of rust-lang#117161, without the binary op precedence.

Fixes rust-lang#117155
`@rustbot` labels +I-lang-nominated
cc `@scottmcm`
r? compiler
…oss35

Fix connect timeout for non-linux targets, read readiness of socket connection, Read readiness to detect errors. `Fixes rust-lang#127018`

Fixes rust-lang#127018
Connect_timeout would call `poll` and check `pollfd.revents` for POLLHUP error, rather that checking readiness. This behavior was meant for Linux as it returns POLLHUP | POLLOUT | POLLERR in case of errors. But on targets that do not return POLLHUP in `pollfd.revents`, this would indicate a false success and result in this issue. To resolve this we will check readiness of socket using  `getsockopt():`  and return success from connect_timeout when there are no errors.
Changes were tested on Linux and an rtos.
![Screenshot 2024-07-04 105820](https://github.com/rust-lang/rust/assets/88673422/5ef5a87f-f2af-4fb7-98da-7612d5e27e9a)
Thank you.
…=lcnr

`#[naked]`: use an allowlist for allowed options on `asm!` in naked functions

tracking issue: rust-lang#90957

this is mostly just a refactor, but using an allowlist (rather than a denylist) for which asm options are allowed in naked functions is a little safer.

These options are disallowed because naked functions are effectively global asm, but defined using inline asm.
…lity-gcc, r=ChrisDenton

std: unsafe-wrap personality::gcc

Nothing seems obviously wrong with these implementations except for some unanswered questions. Admittedly, I don't want to burn excessive time on exceptional exception handlers. Thus this is mostly a brute-force syntactic wrapping and some comments where they seemed correct, creating another largely whitespace diff.

try-job: armhf-gnu
Make sure that args are compatible in `resolve_associated_item`

Implements a similar check to the one that we have in projection for GATs (rust-lang#102488, rust-lang#123240), where we check that the args of an impl item are compatible before returning it. This is done in `resolve_assoc_item`, which is backing `Instance::resolve`, so this is conceptually generalizing the check from GATs to methods/assoc consts. This is important to make sure that the inliner will only visit and substitute MIR bodies that are compatible w/ their trait definitions.

This shouldn't happen in codegen, but there are a few ways to get the inliner to be invoked (via calls to `optimized_mir`) before codegen, namely polymorphization and CTFE.

Fixes rust-lang#121957
Fixes rust-lang#120792
Fixes rust-lang#120793
Fixes rust-lang#121063
…enyukang

Don't ICE if HIR and middle types disagree in borrowck error reporting

We try to match up the `middle::ty::Ty` and `hir::Ty` types in borrowck error reporting, but due to things like `Self` self type alias, or regular type aliases, these might not match up. Don't ICE.

This PR also tries to recover the error by looking up the self type of the impl in case we see `Self`. The diagnostic is frankly quite confusing, but I also didn't really want to look at it because I don't understand the conflict error reporting logic. 🤷

Fixes rust-lang#121816
…, r=oli-obk

Remove crashes for misuses of intrinsics

All of these do not crash if the feature gate is removed. An ICE due *opting into* the intrinsics feature gate is not a bug that needs to be fixed, but instead a misuse of an internal-only API.

See rust-lang/compiler-team#620

The last two issues are already closed anyways, but:
Fixes rust-lang#97501
Fixes rust-lang#111699
Fixes rust-lang#101962
@rustbot rustbot added O-unix Operating system: Unix-like 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 25, 2024
@matthiaskrgr
Copy link
Member Author

@bors r+ rollup=never p=7

@bors
Copy link
Contributor

bors commented Jul 25, 2024

📌 Commit c98d704 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 25, 2024
@ChrisDenton
Copy link
Member

If there's still time, could #128187 be sneaked into the rollup?

@bors
Copy link
Contributor

bors commented Jul 25, 2024

⌛ Testing commit c98d704 with merge eb10639...

@bors
Copy link
Contributor

bors commented Jul 25, 2024

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

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

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#121364 Implement lint against ambiguous negative literals 8d108178310ca7f08d4411662851637bb9814127 (link)
#127300 Fix connect timeout for non-linux targets, read readiness o… 0e65ce0770bf86aae4a910d035851333068544c8 (link)
#128138 #[naked]: use an allowlist for allowed options on asm! 52f5065c0d5adf2d5afe36d932bde253e6d4b11a (link)
#128158 std: unsafe-wrap personality::gcc ad0d4cc82fb3dce10039ac20c7a1a1ed9dc3bf01 (link)
#128171 Make sure that args are compatible in `resolve_associated_i… d221ee95621f1688f1a160b546adb68f91d6af0f (link)
#128172 Don't ICE if HIR and middle types disagree in borrowck erro… f7f1f271c03993eee3f295f721266725274536ff (link)
#128173 Remove crashes for misuses of intrinsics 42a28d6a753e8e0555df4cbcab8c36b333870148 (link)

previous master: 54be9ad5eb

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 (eb10639): 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.5%] 11
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.3% [0.2%, 0.5%] 11

Max RSS (memory usage)

Results (secondary 5.9%)

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

Cycles

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

Binary size

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

Bootstrap: 769.25s -> 769.861s (0.08%)
Artifact size: 328.92 MiB -> 328.92 MiB (-0.00%)

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

Kobzol commented Jul 26, 2024

Seems like noise, the regressions went back in the following commit.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Jul 26, 2024
@matthiaskrgr matthiaskrgr deleted the rollup-01b7t98 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-unix Operating system: Unix-like 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.

10 participants