Skip to content

Commit 4ed05c2

Browse files
committed
The bounds will continue until morale improves
1 parent ebade90 commit 4ed05c2

File tree

9 files changed

+28
-29
lines changed

9 files changed

+28
-29
lines changed

library/alloc/src/boxed.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2025,7 +2025,7 @@ unsafe impl<T: ?Sized, A: Allocator> PinCoerceUnsized for Box<T, A> {}
20252025
// Handling arbitrary custom allocators (which can affect the `Box` layout heavily!)
20262026
// would need a lot of codegen and interpreter adjustments.
20272027
#[unstable(feature = "dispatch_from_dyn", issue = "none")]
2028-
impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Box<U>> for Box<T, Global> {}
2028+
impl<T: ?Sized + Unsize<U>, U: ?Sized + ?core::marker::Sized> DispatchFromDyn<Box<U>> for Box<T, Global> {}
20292029

20302030
#[stable(feature = "box_borrow", since = "1.1.0")]
20312031
impl<T: ?Sized, A: Allocator> Borrow<T> for Box<T, A> {

library/core/src/cell.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ pub use once::OnceCell;
309309
#[stable(feature = "rust1", since = "1.0.0")]
310310
#[repr(transparent)]
311311
#[rustc_pub_transparent]
312-
pub struct Cell<T: ?Sized> {
312+
pub struct Cell<T: ?Sized + ?core::marker::Move> {
313313
value: UnsafeCell<T>,
314314
}
315315

@@ -322,7 +322,7 @@ unsafe impl<T: ?Sized> Send for Cell<T> where T: Send {}
322322
// having an explicit negative impl is nice for documentation purposes
323323
// and results in nicer error messages.
324324
#[stable(feature = "rust1", since = "1.0.0")]
325-
impl<T: ?Sized> !Sync for Cell<T> {}
325+
impl<T: ?Sized + ?crate::marker::Move> !Sync for Cell<T> {}
326326

327327
#[stable(feature = "rust1", since = "1.0.0")]
328328
impl<T: Copy> Clone for Cell<T> {
@@ -668,7 +668,7 @@ impl<T: CoerceUnsized<U>, U> CoerceUnsized<Cell<U>> for Cell<T> {}
668668
// `self: Cell<&Self>` won't work
669669
// `self: CellWrapper<Self>` becomes possible
670670
#[unstable(feature = "dispatch_from_dyn", issue = "none")]
671-
impl<T: DispatchFromDyn<U>, U> DispatchFromDyn<Cell<U>> for Cell<T> {}
671+
impl<T: DispatchFromDyn<U>, U: ?crate::marker::Move> DispatchFromDyn<Cell<U>> for Cell<T> {}
672672

673673
impl<T> Cell<[T]> {
674674
/// Returns a `&[Cell<T>]` from a `&Cell<[T]>`
@@ -2090,12 +2090,12 @@ impl<T: ?Sized + fmt::Display> fmt::Display for RefMut<'_, T> {
20902090
#[stable(feature = "rust1", since = "1.0.0")]
20912091
#[repr(transparent)]
20922092
#[rustc_pub_transparent]
2093-
pub struct UnsafeCell<T: ?Sized> {
2093+
pub struct UnsafeCell<T: ?Sized + ?crate::marker::Move> {
20942094
value: T,
20952095
}
20962096

20972097
#[stable(feature = "rust1", since = "1.0.0")]
2098-
impl<T: ?Sized> !Sync for UnsafeCell<T> {}
2098+
impl<T: ?Sized + ?crate::marker::Move> !Sync for UnsafeCell<T> {}
20992099

21002100
impl<T> UnsafeCell<T> {
21012101
/// Constructs a new instance of `UnsafeCell` which will wrap the specified
@@ -2359,7 +2359,7 @@ impl<T: CoerceUnsized<U>, U> CoerceUnsized<UnsafeCell<U>> for UnsafeCell<T> {}
23592359
// `self: UnsafeCell<&Self>` won't work
23602360
// `self: UnsafeCellWrapper<Self>` becomes possible
23612361
#[unstable(feature = "dispatch_from_dyn", issue = "none")]
2362-
impl<T: DispatchFromDyn<U>, U> DispatchFromDyn<UnsafeCell<U>> for UnsafeCell<T> {}
2362+
impl<T: DispatchFromDyn<U>, U: ?crate::marker::Move> DispatchFromDyn<UnsafeCell<U>> for UnsafeCell<T> {}
23632363

23642364
/// [`UnsafeCell`], but [`Sync`].
23652365
///
@@ -2377,7 +2377,7 @@ impl<T: DispatchFromDyn<U>, U> DispatchFromDyn<UnsafeCell<U>> for UnsafeCell<T>
23772377
#[repr(transparent)]
23782378
#[rustc_diagnostic_item = "SyncUnsafeCell"]
23792379
#[rustc_pub_transparent]
2380-
pub struct SyncUnsafeCell<T: ?Sized> {
2380+
pub struct SyncUnsafeCell<T: ?Sized + ?crate::marker::Move> {
23812381
value: UnsafeCell<T>,
23822382
}
23832383

@@ -2466,7 +2466,7 @@ impl<T: CoerceUnsized<U>, U> CoerceUnsized<SyncUnsafeCell<U>> for SyncUnsafeCell
24662466
// `self: SyncUnsafeCellWrapper<Self>` becomes possible
24672467
#[unstable(feature = "dispatch_from_dyn", issue = "none")]
24682468
//#[unstable(feature = "sync_unsafe_cell", issue = "95439")]
2469-
impl<T: DispatchFromDyn<U>, U> DispatchFromDyn<SyncUnsafeCell<U>> for SyncUnsafeCell<T> {}
2469+
impl<T: DispatchFromDyn<U>, U: ?crate::marker::Move> DispatchFromDyn<SyncUnsafeCell<U>> for SyncUnsafeCell<T> {}
24702470

24712471
#[allow(unused)]
24722472
fn assert_coerce_unsized(

library/core/src/marker.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ impl<T: PointeeSized> !Sync for *mut T {}
820820
/// [drop check]: Drop#drop-check
821821
#[lang = "phantom_data"]
822822
#[stable(feature = "rust1", since = "1.0.0")]
823-
pub struct PhantomData<T: PointeeSized>;
823+
pub struct PhantomData<T: PointeeSized + ?crate::marker::Move>;
824824

825825
#[stable(feature = "rust1", since = "1.0.0")]
826826
impl<T: PointeeSized> Hash for PhantomData<T> {
@@ -914,7 +914,7 @@ pub trait DiscriminantKind {
914914
pub unsafe auto trait Freeze {}
915915

916916
#[unstable(feature = "freeze", issue = "121675")]
917-
impl<T: PointeeSized> !Freeze for UnsafeCell<T> {}
917+
impl<T: PointeeSized + ?crate::marker::Move> !Freeze for UnsafeCell<T> {}
918918
marker_impls! {
919919
#[unstable(feature = "freeze", issue = "121675")]
920920
unsafe Freeze for
@@ -934,7 +934,7 @@ marker_impls! {
934934
#[lang = "unsafe_unpin"]
935935
pub(crate) unsafe auto trait UnsafeUnpin {}
936936

937-
impl<T: ?Sized> !UnsafeUnpin for UnsafePinned<T> {}
937+
impl<T: ?Sized + ?crate::marker::Move> !UnsafeUnpin for UnsafePinned<T> {}
938938
unsafe impl<T: ?Sized> UnsafeUnpin for PhantomData<T> {}
939939
unsafe impl<T: ?Sized> UnsafeUnpin for *const T {}
940940
unsafe impl<T: ?Sized> UnsafeUnpin for *mut T {}
@@ -1378,7 +1378,6 @@ pub unsafe auto trait Move {
13781378
marker_impls! {
13791379
#[unstable(feature = "move_trait", issue = "none")]
13801380
unsafe Move for
1381-
{T: ?Sized} PhantomData<T>,
13821381
{T: ?Sized} *const T,
13831382
{T: ?Sized} *mut T,
13841383
{T: ?Sized} &T,

library/core/src/ops/unsize.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,13 @@ pub trait DispatchFromDyn<T: ?crate::marker::Move> {
122122

123123
// &T -> &U
124124
#[unstable(feature = "dispatch_from_dyn", issue = "none")]
125-
impl<'a, T: PointeeSized + ?crate::marker::Move + Unsize<U>, U: PointeeSized> DispatchFromDyn<&'a U> for &'a T {}
125+
impl<'a, T: PointeeSized + ?crate::marker::Move + Unsize<U>, U: PointeeSized + ?crate::marker::Move> DispatchFromDyn<&'a U> for &'a T {}
126126
// &mut T -> &mut U
127127
#[unstable(feature = "dispatch_from_dyn", issue = "none")]
128-
impl<'a, T: PointeeSized + ?crate::marker::Move + Unsize<U>, U: PointeeSized> DispatchFromDyn<&'a mut U> for &'a mut T {}
128+
impl<'a, T: PointeeSized + ?crate::marker::Move + Unsize<U>, U: PointeeSized + ?crate::marker::Move> DispatchFromDyn<&'a mut U> for &'a mut T {}
129129
// *const T -> *const U
130130
#[unstable(feature = "dispatch_from_dyn", issue = "none")]
131-
impl<T: PointeeSized + ?crate::marker::Move + Unsize<U>, U: PointeeSized> DispatchFromDyn<*const U> for *const T {}
131+
impl<T: PointeeSized + ?crate::marker::Move + Unsize<U>, U: PointeeSized + ?crate::marker::Move> DispatchFromDyn<*const U> for *const T {}
132132
// *mut T -> *mut U
133133
#[unstable(feature = "dispatch_from_dyn", issue = "none")]
134-
impl<T: PointeeSized + ?crate::marker::Move + Unsize<U>, U: PointeeSized> DispatchFromDyn<*mut U> for *mut T {}
134+
impl<T: PointeeSized + ?crate::marker::Move + Unsize<U>, U: PointeeSized + ?crate::marker::Move> DispatchFromDyn<*mut U> for *mut T {}

library/core/src/panic/unwind_safe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ impl<T> UnwindSafe for AssertUnwindSafe<T> {}
197197
// only thing which doesn't implement it (which then transitively applies to
198198
// everything else).
199199
#[stable(feature = "catch_unwind", since = "1.9.0")]
200-
impl<T: ?Sized> !RefUnwindSafe for UnsafeCell<T> {}
200+
impl<T: ?Sized + ?crate::marker::Move> !RefUnwindSafe for UnsafeCell<T> {}
201201
#[stable(feature = "catch_unwind", since = "1.9.0")]
202202
impl<T> RefUnwindSafe for AssertUnwindSafe<T> {}
203203

library/core/src/pin.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,7 @@ pub use self::unsafe_pinned::UnsafePinned;
10911091
#[repr(transparent)]
10921092
#[rustc_pub_transparent]
10931093
#[derive(Copy, Clone)]
1094-
pub struct Pin<Ptr> {
1094+
pub struct Pin<Ptr: ?crate::marker::Move> {
10951095
pointer: Ptr,
10961096
}
10971097

@@ -1727,7 +1727,7 @@ where
17271727
impl<Ptr, U> DispatchFromDyn<Pin<U>> for Pin<Ptr>
17281728
where
17291729
Ptr: DispatchFromDyn<U> + PinCoerceUnsized,
1730-
U: PinCoerceUnsized,
1730+
U: PinCoerceUnsized + ?crate::marker::Move,
17311731
{
17321732
}
17331733

library/core/src/pin/unsafe_pinned.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use crate::{fmt, ptr};
2424
#[lang = "unsafe_pinned"]
2525
#[repr(transparent)]
2626
#[unstable(feature = "unsafe_pinned", issue = "125735")]
27-
pub struct UnsafePinned<T: ?Sized> {
27+
pub struct UnsafePinned<T: ?Sized + ?crate::marker::Move> {
2828
value: UnsafeCell<T>,
2929
}
3030

@@ -36,7 +36,7 @@ unsafe impl<T: ?Sized + Sync> Sync for UnsafePinned<T> {}
3636
/// aliases from becoming invalidated. Therefore let's mark this as `!Unpin`. You can always opt
3737
/// back in to `Unpin` with an `impl` block, provided your API is still sound while unpinned.
3838
#[unstable(feature = "unsafe_pinned", issue = "125735")]
39-
impl<T: ?Sized> !Unpin for UnsafePinned<T> {}
39+
impl<T: ?Sized + ?crate::marker::Move> !Unpin for UnsafePinned<T> {}
4040

4141
// `Send` and `Sync` are inherited from `T`. This is similar to `SyncUnsafeCell`, since
4242
// we eventually concluded that `UnsafeCell` implicitly making things `!Sync` is sometimes
@@ -176,6 +176,6 @@ impl<T: CoerceUnsized<U>, U> CoerceUnsized<UnsafePinned<U>> for UnsafePinned<T>
176176
// FIXME(unsafe_pinned) this logic is copied from UnsafeCell, is it still sound?
177177
#[unstable(feature = "dispatch_from_dyn", issue = "none")]
178178
// #[unstable(feature = "unsafe_pinned", issue = "125735")]
179-
impl<T: DispatchFromDyn<U>, U> DispatchFromDyn<UnsafePinned<U>> for UnsafePinned<T> {}
179+
impl<T: DispatchFromDyn<U>, U: ?crate::marker::Move> DispatchFromDyn<UnsafePinned<U>> for UnsafePinned<T> {}
180180

181181
// FIXME(unsafe_pinned): impl PinCoerceUnsized for UnsafePinned<T>?

library/core/src/ptr/non_null.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ use crate::{fmt, hash, intrinsics, mem, ptr};
7272
#[rustc_layout_scalar_valid_range_start(1)]
7373
#[rustc_nonnull_optimization_guaranteed]
7474
#[rustc_diagnostic_item = "NonNull"]
75-
pub struct NonNull<T: PointeeSized> {
75+
pub struct NonNull<T: PointeeSized + ?crate::marker::Move> {
7676
// Remember to use `.as_ptr()` instead of `.pointer`, as field projecting to
7777
// this is banned by <https://github.com/rust-lang/compiler-team/issues/807>.
7878
pointer: *const T,
@@ -81,12 +81,12 @@ pub struct NonNull<T: PointeeSized> {
8181
/// `NonNull` pointers are not `Send` because the data they reference may be aliased.
8282
// N.B., this impl is unnecessary, but should provide better error messages.
8383
#[stable(feature = "nonnull", since = "1.25.0")]
84-
impl<T: PointeeSized> !Send for NonNull<T> {}
84+
impl<T: PointeeSized + ?crate::marker::Move> !Send for NonNull<T> {}
8585

8686
/// `NonNull` pointers are not `Sync` because the data they reference may be aliased.
8787
// N.B., this impl is unnecessary, but should provide better error messages.
8888
#[stable(feature = "nonnull", since = "1.25.0")]
89-
impl<T: PointeeSized> !Sync for NonNull<T> {}
89+
impl<T: PointeeSized + ?crate::marker::Move> !Sync for NonNull<T> {}
9090

9191
impl<T: Sized> NonNull<T> {
9292
/// Creates a pointer with the given address and no [provenance][crate::ptr#provenance].
@@ -1624,7 +1624,7 @@ impl<T: PointeeSized> Copy for NonNull<T> {}
16241624
impl<T: PointeeSized, U: PointeeSized> CoerceUnsized<NonNull<U>> for NonNull<T> where T: Unsize<U> {}
16251625

16261626
#[unstable(feature = "dispatch_from_dyn", issue = "none")]
1627-
impl<T: PointeeSized, U: PointeeSized> DispatchFromDyn<NonNull<U>> for NonNull<T> where T: Unsize<U> {}
1627+
impl<T: PointeeSized, U: PointeeSized + ?core::marker::Move> DispatchFromDyn<NonNull<U>> for NonNull<T> where T: Unsize<U> {}
16281628

16291629
#[stable(feature = "pin", since = "1.33.0")]
16301630
unsafe impl<T: PointeeSized> PinCoerceUnsized for NonNull<T> {}

library/core/src/ptr/unique.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use crate::ptr::NonNull;
3232
)]
3333
#[doc(hidden)]
3434
#[repr(transparent)]
35-
pub struct Unique<T: PointeeSized> {
35+
pub struct Unique<T: PointeeSized + ?crate::marker::Move> {
3636
pointer: NonNull<T>,
3737
// NOTE: this marker has no consequences for variance, but is necessary
3838
// for dropck to understand that we logically own a `T`.
@@ -169,7 +169,7 @@ impl<T: PointeeSized> Copy for Unique<T> {}
169169
impl<T: PointeeSized, U: PointeeSized> CoerceUnsized<Unique<U>> for Unique<T> where T: Unsize<U> {}
170170

171171
#[unstable(feature = "ptr_internals", issue = "none")]
172-
impl<T: PointeeSized, U: PointeeSized> DispatchFromDyn<Unique<U>> for Unique<T> where T: Unsize<U> {}
172+
impl<T: PointeeSized, U: PointeeSized + ?crate::marker::Move> DispatchFromDyn<Unique<U>> for Unique<T> where T: Unsize<U> {}
173173

174174
#[unstable(feature = "pin_coerce_unsized_trait", issue = "123430")]
175175
unsafe impl<T: PointeeSized> PinCoerceUnsized for Unique<T> {}

0 commit comments

Comments
 (0)