Update UnsafeUnpin impls involving extern types.#152646
Update UnsafeUnpin impls involving extern types.#152646rust-bors[bot] merged 1 commit intorust-lang:mainfrom
UnsafeUnpin impls involving extern types.#152646Conversation
Also updates the marker_impls macro docs to use PointeeSized bound, as most uses of the macro now do.
|
r? @jhpratt rustbot has assigned @jhpratt. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
I'm unfamiliar with the @rustbot reroll |
|
I see in the tracking issue for Sized hierarchy (#144404) this note:
This implies to me that either this isn't effective or there's something special about UnsafeUnpin's trait (maybe the fact it's Am I correctly interpreting that PointeeSized is the 'lowest rung' of the ladder currently proposed? It's confusing to me that the RFC's current text (https://github.com/davidtwco/rfcs/blob/sized-hierarchy/text/3729-sized-hierarchy.md#guide-level-explanation) has cc @davidtwco |
Yes, Either way, this would not affect the impls for This would be important for the
Yes, my understanding is that the name Footnotes
|
|
@bors r+ |
…uwer Rollup of 6 pull requests Successful merges: - #152535 (std: use `OnceLock` for Xous environment variables) - #152646 (Update `UnsafeUnpin` impls involving extern types.) - #153559 (Inline and simplify some code for saving incremental data to disk) - #151900 (num: Separate public API from internal implementations) - #153520 (.mailmap: fix broken line with multiple emails) - #153573 (rustdoc-json: fix incorrect documentation for VariantKind::Struct) Failed merges: - #153509 (Cleanup unused diagnostic emission methods - part 2)
Rollup merge of #152646 - zachs18:unsafeunpin-marker-impls-pointee, r=Mark-Simulacrum Update `UnsafeUnpin` impls involving extern types. `UnsafeUnpin` tracking issue: #125735 Relaxes from `T: ?Sized` (i.e. `T: MetaSized`) to `T: PointeeSized` for the `UnsafeUnpin` impls for pointers, references, and `PhantomData<T>`, and for the negative `UnsafeUnpin` impl for `UnsafePinned<T>`. (Compare to the impls for `Freeze` on lines 911-921.) Both `UnsafeUnpin` and `extern type`s (the only way to have a `!MetaSized` type) are unstable, so this should have no effect on stable code. Also updates the marker_impls macro docs to use PointeeSized bound, as most uses of the macro now do. Concretely, this change means that the following types will newly implement `UnsafeUnpin`: * pointers and references to `T` where `T` is an `extern type` * `PhantomData<T>` where `T` is an extern type * either of the above where `T` is a `struct` or tuple with `extern type` tail Additionally, the negative `UnsafeUnpin` impl for `UnsafePinned<T>` is also relaxed to `T: PointeeSized` to align with the analogous negative `Freeze` impl for `UnsafeCell<T>`, even though both structs have `T: ?Sized` in their declaration (which probably should be relaxed, but that is a separate issue), so this part of the change doesn't actually *do* anything currently, but if `UnsafeCell` and `UnsafePinned` are later relaxed to `T: PointeeSized`, then the negative impl will apply to the newly possible instantiations. Also cc #152645 that these impls compile at all.
…ed, r=scottmcm Change `?Sized` to `PointeeSized` in `UnwindSafe` impls for pointers Tracking issue: rust-lang#144404. This PR is similar to rust-lang#152646.
…ed, r=scottmcm Change `?Sized` to `PointeeSized` in `UnwindSafe` impls for pointers Tracking issue: rust-lang#144404. This PR is similar to rust-lang#152646.
UnsafeUnpintracking issue: #125735Relaxes from
T: ?Sized(i.e.T: MetaSized) toT: PointeeSizedfor theUnsafeUnpinimpls for pointers, references, andPhantomData<T>, and for the negativeUnsafeUnpinimpl forUnsafePinned<T>. (Compare to the impls forFreezeon lines 911-921.)Both
UnsafeUnpinandextern types (the only way to have a!MetaSizedtype) are unstable, so this should have no effect on stable code.Also updates the marker_impls macro docs to use PointeeSized bound, as most uses of the macro now do.
Concretely, this change means that the following types will newly implement
UnsafeUnpin:TwhereTis anextern typePhantomData<T>whereTis an extern typeTis astructor tuple withextern typetailAdditionally, the negative
UnsafeUnpinimpl forUnsafePinned<T>is also relaxed toT: PointeeSizedto align with the analogous negativeFreezeimpl forUnsafeCell<T>, even though both structs haveT: ?Sizedin their declaration (which probably should be relaxed, but that is a separate issue), so this part of the change doesn't actually do anything currently, but ifUnsafeCellandUnsafePinnedare later relaxed toT: PointeeSized, then the negative impl will apply to the newly possible instantiations. Also cc #152645 that these impls compile at all.