Skip to content

Commit 01c76d6

Browse files
committed
fix formatting
1 parent 4ed05c2 commit 01c76d6

File tree

6 files changed

+70
-33
lines changed

6 files changed

+70
-33
lines changed

library/alloc/src/boxed.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2025,7 +2025,10 @@ 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 + ?core::marker::Sized> DispatchFromDyn<Box<U>> for Box<T, Global> {}
2028+
impl<T: ?Sized + Unsize<U>, U: ?Sized + ?core::marker::Sized> DispatchFromDyn<Box<U>>
2029+
for Box<T, Global>
2030+
{
2031+
}
20292032

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

library/core/src/cell.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,11 @@
250250
251251
#![stable(feature = "rust1", since = "1.0.0")]
252252

253+
use core::marker::Move;
254+
253255
use crate::cmp::Ordering;
254256
use crate::fmt::{self, Debug, Display};
255-
use crate::marker::{PhantomData, Unsize};
257+
use crate::marker::{Move, PhantomData, Unsize};
256258
use crate::mem;
257259
use crate::ops::{CoerceUnsized, Deref, DerefMut, DerefPure, DispatchFromDyn};
258260
use crate::panic::const_panic;
@@ -309,7 +311,7 @@ pub use once::OnceCell;
309311
#[stable(feature = "rust1", since = "1.0.0")]
310312
#[repr(transparent)]
311313
#[rustc_pub_transparent]
312-
pub struct Cell<T: ?Sized + ?core::marker::Move> {
314+
pub struct Cell<T: ?Sized + ?Move> {
313315
value: UnsafeCell<T>,
314316
}
315317

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

327329
#[stable(feature = "rust1", since = "1.0.0")]
328330
impl<T: Copy> Clone for Cell<T> {
@@ -668,7 +670,7 @@ impl<T: CoerceUnsized<U>, U> CoerceUnsized<Cell<U>> for Cell<T> {}
668670
// `self: Cell<&Self>` won't work
669671
// `self: CellWrapper<Self>` becomes possible
670672
#[unstable(feature = "dispatch_from_dyn", issue = "none")]
671-
impl<T: DispatchFromDyn<U>, U: ?crate::marker::Move> DispatchFromDyn<Cell<U>> for Cell<T> {}
673+
impl<T: DispatchFromDyn<U>, U: ?Move> DispatchFromDyn<Cell<U>> for Cell<T> {}
672674

673675
impl<T> Cell<[T]> {
674676
/// Returns a `&[Cell<T>]` from a `&Cell<[T]>`
@@ -2090,12 +2092,12 @@ impl<T: ?Sized + fmt::Display> fmt::Display for RefMut<'_, T> {
20902092
#[stable(feature = "rust1", since = "1.0.0")]
20912093
#[repr(transparent)]
20922094
#[rustc_pub_transparent]
2093-
pub struct UnsafeCell<T: ?Sized + ?crate::marker::Move> {
2095+
pub struct UnsafeCell<T: ?Sized + ?Move> {
20942096
value: T,
20952097
}
20962098

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

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

23642366
/// [`UnsafeCell`], but [`Sync`].
23652367
///
@@ -2377,7 +2379,7 @@ impl<T: DispatchFromDyn<U>, U: ?crate::marker::Move> DispatchFromDyn<UnsafeCell<
23772379
#[repr(transparent)]
23782380
#[rustc_diagnostic_item = "SyncUnsafeCell"]
23792381
#[rustc_pub_transparent]
2380-
pub struct SyncUnsafeCell<T: ?Sized + ?crate::marker::Move> {
2382+
pub struct SyncUnsafeCell<T: ?Sized + ?Move> {
23812383
value: UnsafeCell<T>,
23822384
}
23832385

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

24712473
#[allow(unused)]
24722474
fn assert_coerce_unsized(

library/core/src/ops/unsize.rs

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::marker::{PointeeSized, Unsize};
1+
use crate::marker::{Move, PointeeSized, Unsize};
22

33
/// Trait that indicates that this is a pointer or a wrapper for one,
44
/// where unsizing can be performed on the pointee.
@@ -39,34 +39,46 @@ pub trait CoerceUnsized<T: PointeeSized> {
3939

4040
// &mut T -> &mut U
4141
#[unstable(feature = "coerce_unsized", issue = "18598")]
42-
impl<'a, T: PointeeSized + ?crate::marker::Move + Unsize<U>, U: PointeeSized> CoerceUnsized<&'a mut U> for &'a mut T {}
42+
impl<'a, T: PointeeSized + ?Move + Unsize<U>, U: PointeeSized> CoerceUnsized<&'a mut U>
43+
for &'a mut T
44+
{
45+
}
4346
// &mut T -> &U
4447
#[unstable(feature = "coerce_unsized", issue = "18598")]
45-
impl<'a, 'b: 'a, T: PointeeSized + ?crate::marker::Move + Unsize<U>, U: PointeeSized> CoerceUnsized<&'a U> for &'b mut T {}
48+
impl<'a, 'b: 'a, T: PointeeSized + ?Move + Unsize<U>, U: PointeeSized> CoerceUnsized<&'a U>
49+
for &'b mut T
50+
{
51+
}
4652
// &mut T -> *mut U
4753
#[unstable(feature = "coerce_unsized", issue = "18598")]
48-
impl<'a, T: PointeeSized + ?crate::marker::Move + Unsize<U>, U: PointeeSized> CoerceUnsized<*mut U> for &'a mut T {}
54+
impl<'a, T: PointeeSized + ?Move + Unsize<U>, U: PointeeSized> CoerceUnsized<*mut U> for &'a mut T {}
4955
// &mut T -> *const U
5056
#[unstable(feature = "coerce_unsized", issue = "18598")]
51-
impl<'a, T: PointeeSized + ?crate::marker::Move + Unsize<U>, U: PointeeSized> CoerceUnsized<*const U> for &'a mut T {}
57+
impl<'a, T: PointeeSized + ?Move + Unsize<U>, U: PointeeSized> CoerceUnsized<*const U>
58+
for &'a mut T
59+
{
60+
}
5261

5362
// &T -> &U
5463
#[unstable(feature = "coerce_unsized", issue = "18598")]
55-
impl<'a, 'b: 'a, T: PointeeSized + ?crate::marker::Move + Unsize<U>, U: PointeeSized> CoerceUnsized<&'a U> for &'b T {}
64+
impl<'a, 'b: 'a, T: PointeeSized + ?Move + Unsize<U>, U: PointeeSized> CoerceUnsized<&'a U>
65+
for &'b T
66+
{
67+
}
5668
// &T -> *const U
5769
#[unstable(feature = "coerce_unsized", issue = "18598")]
58-
impl<'a, T: PointeeSized + ?crate::marker::Move + Unsize<U>, U: PointeeSized> CoerceUnsized<*const U> for &'a T {}
70+
impl<'a, T: PointeeSized + ?Move + Unsize<U>, U: PointeeSized> CoerceUnsized<*const U> for &'a T {}
5971

6072
// *mut T -> *mut U
6173
#[unstable(feature = "coerce_unsized", issue = "18598")]
62-
impl<T: PointeeSized + ?crate::marker::Move + Unsize<U>, U: PointeeSized> CoerceUnsized<*mut U> for *mut T {}
74+
impl<T: PointeeSized + ?Move + Unsize<U>, U: PointeeSized> CoerceUnsized<*mut U> for *mut T {}
6375
// *mut T -> *const U
6476
#[unstable(feature = "coerce_unsized", issue = "18598")]
65-
impl<T: PointeeSized + ?crate::marker::Move + Unsize<U>, U: PointeeSized> CoerceUnsized<*const U> for *mut T {}
77+
impl<T: PointeeSized + ?Move + Unsize<U>, U: PointeeSized> CoerceUnsized<*const U> for *mut T {}
6678

6779
// *const T -> *const U
6880
#[unstable(feature = "coerce_unsized", issue = "18598")]
69-
impl<T: PointeeSized + ?crate::marker::Move + Unsize<U>, U: PointeeSized> CoerceUnsized<*const U> for *const T {}
81+
impl<T: PointeeSized + ?Move + Unsize<U>, U: PointeeSized> CoerceUnsized<*const U> for *const T {}
7082

7183
/// `DispatchFromDyn` is used in the implementation of dyn-compatibility[^1] checks (specifically
7284
/// allowing arbitrary self types), to guarantee that a method's receiver type can be dispatched on.
@@ -116,19 +128,31 @@ impl<T: PointeeSized + ?crate::marker::Move + Unsize<U>, U: PointeeSized> Coerce
116128
/// [^1]: Formerly known as *object safety*.
117129
#[unstable(feature = "dispatch_from_dyn", issue = "none")]
118130
#[lang = "dispatch_from_dyn"]
119-
pub trait DispatchFromDyn<T: ?crate::marker::Move> {
131+
pub trait DispatchFromDyn<T: ?Move> {
120132
// Empty.
121133
}
122134

123135
// &T -> &U
124136
#[unstable(feature = "dispatch_from_dyn", issue = "none")]
125-
impl<'a, T: PointeeSized + ?crate::marker::Move + Unsize<U>, U: PointeeSized + ?crate::marker::Move> DispatchFromDyn<&'a U> for &'a T {}
137+
impl<'a, T: PointeeSized + ?Move + Unsize<U>, U: PointeeSized + ?Move> DispatchFromDyn<&'a U>
138+
for &'a T
139+
{
140+
}
126141
// &mut T -> &mut U
127142
#[unstable(feature = "dispatch_from_dyn", issue = "none")]
128-
impl<'a, T: PointeeSized + ?crate::marker::Move + Unsize<U>, U: PointeeSized + ?crate::marker::Move> DispatchFromDyn<&'a mut U> for &'a mut T {}
143+
impl<'a, T: PointeeSized + ?Move + Unsize<U>, U: PointeeSized + ?Move> DispatchFromDyn<&'a mut U>
144+
for &'a mut T
145+
{
146+
}
129147
// *const T -> *const U
130148
#[unstable(feature = "dispatch_from_dyn", issue = "none")]
131-
impl<T: PointeeSized + ?crate::marker::Move + Unsize<U>, U: PointeeSized + ?crate::marker::Move> DispatchFromDyn<*const U> for *const T {}
149+
impl<T: PointeeSized + ?Move + Unsize<U>, U: PointeeSized + ?Move> DispatchFromDyn<*const U>
150+
for *const T
151+
{
152+
}
132153
// *mut T -> *mut U
133154
#[unstable(feature = "dispatch_from_dyn", issue = "none")]
134-
impl<T: PointeeSized + ?crate::marker::Move + Unsize<U>, U: PointeeSized + ?crate::marker::Move> DispatchFromDyn<*mut U> for *mut T {}
155+
impl<T: PointeeSized + ?Move + Unsize<U>, U: PointeeSized + ?Move> DispatchFromDyn<*mut U>
156+
for *mut T
157+
{
158+
}

library/core/src/pin/unsafe_pinned.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::cell::UnsafeCell;
2-
use crate::marker::Unpin;
2+
use crate::marker::{Move, Unpin};
33
use crate::ops::{CoerceUnsized, DispatchFromDyn};
44
use crate::pin::Pin;
55
use crate::{fmt, ptr};
@@ -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 + ?crate::marker::Move> {
27+
pub struct UnsafePinned<T: ?Sized + ?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 + ?crate::marker::Move> !Unpin for UnsafePinned<T> {}
39+
impl<T: ?Sized + ?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: ?crate::marker::Move> DispatchFromDyn<UnsafePinned<U>> for UnsafePinned<T> {}
179+
impl<T: DispatchFromDyn<U>, U: ?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: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use core::marker::Move;
2+
13
use crate::cmp::Ordering;
24
use crate::marker::{PointeeSized, Unsize};
35
use crate::mem::{MaybeUninit, SizedTypeProperties};
@@ -1624,7 +1626,10 @@ impl<T: PointeeSized> Copy for NonNull<T> {}
16241626
impl<T: PointeeSized, U: PointeeSized> CoerceUnsized<NonNull<U>> for NonNull<T> where T: Unsize<U> {}
16251627

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

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

library/core/src/ptr/unique.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::fmt;
2-
use crate::marker::{PhantomData, PointeeSized, Unsize};
2+
use crate::marker::{Move, PhantomData, PointeeSized, Unsize};
33
use crate::ops::{CoerceUnsized, DispatchFromDyn};
44
use crate::pin::PinCoerceUnsized;
55
use crate::ptr::NonNull;
@@ -32,7 +32,7 @@ use crate::ptr::NonNull;
3232
)]
3333
#[doc(hidden)]
3434
#[repr(transparent)]
35-
pub struct Unique<T: PointeeSized + ?crate::marker::Move> {
35+
pub struct Unique<T: PointeeSized + ?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,10 @@ 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 + ?crate::marker::Move> DispatchFromDyn<Unique<U>> for Unique<T> where T: Unsize<U> {}
172+
impl<T: PointeeSized, U: PointeeSized + ?Move> DispatchFromDyn<Unique<U>> for Unique<T> where
173+
T: Unsize<U>
174+
{
175+
}
173176

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

0 commit comments

Comments
 (0)