about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2025-05-27 01:20:48 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2025-05-27 02:54:52 +1000
commitc42d1fc2c6ea5a35d8d74f909a1f69dee5d9ce56 (patch)
tree7eb7d70dc02a95faa1d242e028237c3a1c72a644
parent68597509aa1e50f67000f7c36ccc3378b58e5f5d (diff)
downloadrust-c42d1fc2c6ea5a35d8d74f909a1f69dee5d9ce56.tar.gz
rust-c42d1fc2c6ea5a35d8d74f909a1f69dee5d9ce56.zip
Remove unused `P` stuff.
-rw-r--r--compiler/rustc_ast/src/ptr.rs44
1 files changed, 2 insertions, 42 deletions
diff --git a/compiler/rustc_ast/src/ptr.rs b/compiler/rustc_ast/src/ptr.rs
index 899d8eb7ca9..91f29a4c289 100644
--- a/compiler/rustc_ast/src/ptr.rs
+++ b/compiler/rustc_ast/src/ptr.rs
@@ -17,10 +17,9 @@
 //!   heap, for example). Moreover, a switch to, e.g., `P<'a, T>` would be easy
 //!   and mostly automated.
 
-use std::fmt::{self, Debug, Display};
+use std::fmt::{self, Debug};
 use std::ops::{Deref, DerefMut};
 
-use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
 use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
 
 /// An owned smart pointer.
@@ -37,28 +36,10 @@ pub fn P<T>(value: T) -> P<T> {
 }
 
 impl<T> P<T> {
-    /// Move out of the pointer.
-    /// Intended for chaining transformations not covered by `map`.
-    pub fn and_then<U, F>(self, f: F) -> U
-    where
-        F: FnOnce(T) -> U,
-    {
-        f(*self.ptr)
-    }
-
-    /// Equivalent to `and_then(|x| x)`.
+    /// Consume the `P` and return the wrapped value.
     pub fn into_inner(self) -> T {
         *self.ptr
     }
-
-    /// Optionally produce a new `P<T>` from `self` without reallocating.
-    pub fn filter_map<F>(mut self, f: F) -> Option<P<T>>
-    where
-        F: FnOnce(T) -> Option<T>,
-    {
-        *self.ptr = f(*self.ptr)?;
-        Some(self)
-    }
 }
 
 impl<T: ?Sized> Deref for P<T> {
@@ -87,18 +68,6 @@ impl<T: ?Sized + Debug> Debug for P<T> {
     }
 }
 
-impl<T: Display> Display for P<T> {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        Display::fmt(&**self, f)
-    }
-}
-
-impl<T> fmt::Pointer for P<T> {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        fmt::Pointer::fmt(&self.ptr, f)
-    }
-}
-
 impl<D: Decoder, T: Decodable<D>> Decodable<D> for P<T> {
     fn decode(d: &mut D) -> P<T> {
         P(Decodable::decode(d))
@@ -110,12 +79,3 @@ impl<S: Encoder, T: Encodable<S>> Encodable<S> for P<T> {
         (**self).encode(s);
     }
 }
-
-impl<CTX, T> HashStable<CTX> for P<T>
-where
-    T: ?Sized + HashStable<CTX>,
-{
-    fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher) {
-        (**self).hash_stable(hcx, hasher);
-    }
-}