Skip to content

Commit 038c039

Browse files
Remove PointerLike trait
1 parent 804d68e commit 038c039

File tree

6 files changed

+3
-54
lines changed

6 files changed

+3
-54
lines changed

alloc/src/boxed.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ use core::error::{self, Error};
191191
use core::fmt;
192192
use core::future::Future;
193193
use core::hash::{Hash, Hasher};
194-
use core::marker::{PointerLike, Tuple, Unsize};
194+
use core::marker::{Tuple, Unsize};
195195
use core::mem::{self, SizedTypeProperties};
196196
use core::ops::{
197197
AsyncFn, AsyncFnMut, AsyncFnOnce, CoerceUnsized, Coroutine, CoroutineState, Deref, DerefMut,
@@ -2132,6 +2132,3 @@ impl<E: Error> Error for Box<E> {
21322132
Error::provide(&**self, request);
21332133
}
21342134
}
2135-
2136-
#[unstable(feature = "pointer_like_trait", issue = "none")]
2137-
impl<T> PointerLike for Box<T> {}

alloc/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@
134134
#![feature(panic_internals)]
135135
#![feature(pattern)]
136136
#![feature(pin_coerce_unsized_trait)]
137-
#![feature(pointer_like_trait)]
138137
#![feature(ptr_alignment_type)]
139138
#![feature(ptr_internals)]
140139
#![feature(ptr_metadata)]

core/src/cell.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@
252252

253253
use crate::cmp::Ordering;
254254
use crate::fmt::{self, Debug, Display};
255-
use crate::marker::{PhantomData, PointerLike, Unsize};
255+
use crate::marker::{PhantomData, Unsize};
256256
use crate::mem;
257257
use crate::ops::{CoerceUnsized, Deref, DerefMut, DerefPure, DispatchFromDyn};
258258
use crate::panic::const_panic;
@@ -669,9 +669,6 @@ impl<T: CoerceUnsized<U>, U> CoerceUnsized<Cell<U>> for Cell<T> {}
669669
#[unstable(feature = "dispatch_from_dyn", issue = "none")]
670670
impl<T: DispatchFromDyn<U>, U> DispatchFromDyn<Cell<U>> for Cell<T> {}
671671

672-
#[unstable(feature = "pointer_like_trait", issue = "none")]
673-
impl<T: PointerLike> PointerLike for Cell<T> {}
674-
675672
impl<T> Cell<[T]> {
676673
/// Returns a `&[Cell<T>]` from a `&Cell<[T]>`
677674
///
@@ -2361,9 +2358,6 @@ impl<T: CoerceUnsized<U>, U> CoerceUnsized<UnsafeCell<U>> for UnsafeCell<T> {}
23612358
#[unstable(feature = "dispatch_from_dyn", issue = "none")]
23622359
impl<T: DispatchFromDyn<U>, U> DispatchFromDyn<UnsafeCell<U>> for UnsafeCell<T> {}
23632360

2364-
#[unstable(feature = "pointer_like_trait", issue = "none")]
2365-
impl<T: PointerLike> PointerLike for UnsafeCell<T> {}
2366-
23672361
/// [`UnsafeCell`], but [`Sync`].
23682362
///
23692363
/// This is just an `UnsafeCell`, except it implements `Sync`
@@ -2470,9 +2464,6 @@ impl<T: CoerceUnsized<U>, U> CoerceUnsized<SyncUnsafeCell<U>> for SyncUnsafeCell
24702464
//#[unstable(feature = "sync_unsafe_cell", issue = "95439")]
24712465
impl<T: DispatchFromDyn<U>, U> DispatchFromDyn<SyncUnsafeCell<U>> for SyncUnsafeCell<T> {}
24722466

2473-
#[unstable(feature = "pointer_like_trait", issue = "none")]
2474-
impl<T: PointerLike> PointerLike for SyncUnsafeCell<T> {}
2475-
24762467
#[allow(unused)]
24772468
fn assert_coerce_unsized(
24782469
a: UnsafeCell<&i32>,

core/src/marker.rs

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,37 +1066,6 @@ pub trait Destruct {}
10661066
#[rustc_do_not_implement_via_object]
10671067
pub trait Tuple {}
10681068

1069-
/// A marker for pointer-like types.
1070-
///
1071-
/// This trait can only be implemented for types that are certain to have
1072-
/// the same size and alignment as a [`usize`] or [`*const ()`](pointer).
1073-
/// To ensure this, there are special requirements on implementations
1074-
/// of `PointerLike` (other than the already-provided implementations
1075-
/// for built-in types):
1076-
///
1077-
/// * The type must have `#[repr(transparent)]`.
1078-
/// * The type’s sole non-zero-sized field must itself implement `PointerLike`.
1079-
#[unstable(feature = "pointer_like_trait", issue = "none")]
1080-
#[lang = "pointer_like"]
1081-
#[diagnostic::on_unimplemented(
1082-
message = "`{Self}` needs to have the same ABI as a pointer",
1083-
label = "`{Self}` needs to be a pointer-like type"
1084-
)]
1085-
#[rustc_do_not_implement_via_object]
1086-
pub trait PointerLike {}
1087-
1088-
marker_impls! {
1089-
#[unstable(feature = "pointer_like_trait", issue = "none")]
1090-
PointerLike for
1091-
isize,
1092-
usize,
1093-
{T} &T,
1094-
{T} &mut T,
1095-
{T} *const T,
1096-
{T} *mut T,
1097-
{T: PointerLike} crate::pin::Pin<T>,
1098-
}
1099-
11001069
/// A marker for types which can be used as types of `const` generic parameters.
11011070
///
11021071
/// These types must have a proper equivalence relation (`Eq`) and it must be automatically

core/src/pin/unsafe_pinned.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::cell::UnsafeCell;
2-
use crate::marker::{PointerLike, Unpin};
2+
use crate::marker::Unpin;
33
use crate::ops::{CoerceUnsized, DispatchFromDyn};
44
use crate::pin::Pin;
55
use crate::{fmt, ptr};
@@ -178,8 +178,4 @@ impl<T: CoerceUnsized<U>, U> CoerceUnsized<UnsafePinned<U>> for UnsafePinned<T>
178178
// #[unstable(feature = "unsafe_pinned", issue = "125735")]
179179
impl<T: DispatchFromDyn<U>, U> DispatchFromDyn<UnsafePinned<U>> for UnsafePinned<T> {}
180180

181-
#[unstable(feature = "pointer_like_trait", issue = "none")]
182-
// #[unstable(feature = "unsafe_pinned", issue = "125735")]
183-
impl<T: PointerLike> PointerLike for UnsafePinned<T> {}
184-
185181
// FIXME(unsafe_pinned): impl PinCoerceUnsized for UnsafePinned<T>?

core/src/ptr/non_null.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1628,9 +1628,6 @@ impl<T: PointeeSized, U: PointeeSized> DispatchFromDyn<NonNull<U>> for NonNull<T
16281628
#[stable(feature = "pin", since = "1.33.0")]
16291629
unsafe impl<T: PointeeSized> PinCoerceUnsized for NonNull<T> {}
16301630

1631-
#[unstable(feature = "pointer_like_trait", issue = "none")]
1632-
impl<T> core::marker::PointerLike for NonNull<T> {}
1633-
16341631
#[stable(feature = "nonnull", since = "1.25.0")]
16351632
impl<T: PointeeSized> fmt::Debug for NonNull<T> {
16361633
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {

0 commit comments

Comments
 (0)