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 #128093

Merged
merged 16 commits into from
Jul 23, 2024
Merged

Rollup of 6 pull requests #128093

merged 16 commits into from
Jul 23, 2024

Conversation

matthiaskrgr
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

jieyouxu and others added 16 commits July 19, 2024 13:45
And also point out the def span of the coroutine
The implied deref to statics introduced by HIR->THIR lowering is only
used to create place expressions, it lacks unsafe semantics.
It is also confusing, as there is no visible `*ident` in the source.
For both classes of "unsafe static" (extern static and static mut)
allow this operation.

We lack a clear story around `thread_local! { static mut }`, which
is actually its own category of item that reuses the static syntax but
has its own rules. It's possible they should be similarly included, but
in the absence of a good reason one way or another, we do not bless it.
…k-for-addr-of-static-mut, r=compiler-errors

treat `&raw (const|mut) UNSAFE_STATIC` implied deref as safe

Fixes rust-lang#125833

As reported in that and related issues, `static mut STATIC_MUT: T` is very often used in embedded code, and is in many ways equivalent to `static STATIC_CELL: SyncUnsafeCell<T>`. The Rust expression of `&raw mut STATIC_MUT` and `SyncUnsafeCell::get(&STATIC_CELL)` are approximately equal, and both evaluate to `*mut T`. The library function is safe because it has *declared itself* to be safe. However, the raw ref operator is unsafe because all uses of `static mut` are considered unsafe, even though the static's value is not used by this expression (unlike, for example, `&STATIC_MUT`).

We can fix this unnatural difference by simply adding the proper exclusion for the safety check inside the THIR unsafeck, so that we do not declare it unsafe if it is not.

While the primary concern here is `static mut`, this change is made for all instances of an "unsafe static", which includes a static declared inside `extern "abi" {}`. Hypothetically, we could go as far as generalizing this to all instances of `&raw (const|mut) *ptr`, but today we do not, as we have not actually considered the range of possible expressions that use a similar encoding. We do not even extend this to thread-local equivalents, because they have less clear semantics.
…r=fmease

Cleanup compiletest dylib name calculation

Use `std::env::consts::{DLL_PREFIX, DLL_EXTENSION}` for dylib name calculation which is more accurate for the various different platforms, and is more likely to be looked at by target maintainers.

cc ``@bzEq`` (as this impacts how compiletest handles AIX dll extensions)
Reword E0626 to mention static coroutine, add structured suggestion for adding `static`

Not certain how to make the example feel less artificial. 🤷

My main point though is that we should probably emphasize that the first solution to making a coroutine allow a borrow across an await is making it `static`.

Also adds a structured suggestion.
…lcnr

Get rid of `can_eq_shallow`

✨

r? lcnr
…lcnr

Get rid of `InferCtxtExt` from `error_reporting::traits`

One more cleanup.

r? lcnr
…-make-safe, r=ChrisDenton

std: Unsafe-wrap actually-universal platform code

Every platform compiles the unsafe parts of this code, so just clean this up. Almost entirely a whitespace diff.
@rustbot rustbot added 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. rollup A PR which is a rollup labels Jul 23, 2024
@matthiaskrgr
Copy link
Member Author

@bors r+ rollup=never p=6

@bors
Copy link
Contributor

bors commented Jul 23, 2024

📌 Commit f8373ad 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 23, 2024
@bors
Copy link
Contributor

bors commented Jul 23, 2024

⌛ Testing commit f8373ad with merge d53dc75...

@bors
Copy link
Contributor

bors commented Jul 23, 2024

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

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

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#125834 treat &raw (const|mut) UNSAFE_STATIC implied deref as safe be60c1a1c7bb58c25d2684da5c038c28b3a74196 (link)
#127962 Cleanup compiletest dylib name calculation cf9fb7954b92d31b73aa4a359856ce15277954ac (link)
#128049 Reword E0626 to mention static coroutine, add structured su… 2895744ba8d53c086ca989d148dc5a4102d8f90d (link)
#128067 Get rid of can_eq_shallow dd108bad02a381884f83f660d032b046cc4c7bdd (link)
#128076 Get rid of InferCtxtExt from error_reporting::traits 1f3e643655e5be6422bd149a047d2e8c75022adb (link)
#128089 std: Unsafe-wrap actually-universal platform code c35d1a7aad221120c8f0cae2b8dc9191a9633f71 (link)

previous master: d111ccdb61

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

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

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

Max RSS (memory usage)

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

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.966s -> 770.312s (0.04%)
Artifact size: 328.85 MiB -> 328.81 MiB (-0.01%)

@matthiaskrgr matthiaskrgr deleted the rollup-1snye4b 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
A-testsuite Area: The testsuite used to check the correctness of rustc merged-by-bors This PR was explicitly merged by bors. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants