-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Rollup of 6 pull requests #128093
Conversation
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.
@bors r+ rollup=never p=6 |
☀️ Test successful - checks-actions |
📌 Perf builds for each rolled up PR:
previous master: d111ccdb61 In the case of a perf regression, run the following command for each PR you suspect might be the cause: |
Finished benchmarking commit (d53dc75): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 769.966s -> 770.312s (0.04%) |
Successful merges:
&raw (const|mut) UNSAFE_STATIC
implied deref as safe #125834 (treat&raw (const|mut) UNSAFE_STATIC
implied deref as safe)static
#128049 (Reword E0626 to mention static coroutine, add structured suggestion for addingstatic
)can_eq_shallow
#128067 (Get rid ofcan_eq_shallow
)InferCtxtExt
fromerror_reporting::traits
#128076 (Get rid ofInferCtxtExt
fromerror_reporting::traits
)r? @ghost
@rustbot modify labels: rollup
Create a similar rollup