about summary refs log tree commit diff
path: root/src/librustc/ty
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2019-07-25 01:02:41 +0200
committerRalf Jung <post@ralfj.de>2019-08-02 23:04:11 +0200
commit7b30612c9bf8731abeb42eff684ae15f46a0656d (patch)
tree6d49654b414462b13b96c256b700001d42c03599 /src/librustc/ty
parent144e5e99b5854c15bb9908a61e38b23f66fb6b46 (diff)
downloadrust-7b30612c9bf8731abeb42eff684ae15f46a0656d.tar.gz
rust-7b30612c9bf8731abeb42eff684ae15f46a0656d.zip
add is_any_ptr type test; this also helps pacify tidy
Diffstat (limited to 'src/librustc/ty')
-rw-r--r--src/librustc/ty/sty.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs
index 77b8ebba216..14da3875cdd 100644
--- a/src/librustc/ty/sty.rs
+++ b/src/librustc/ty/sty.rs
@@ -1863,6 +1863,12 @@ impl<'tcx> TyS<'tcx> {
         }
     }
 
+    /// Tests if this is any kind of primitive pointer type (reference, raw pointer, fn pointer).
+    #[inline]
+    pub fn is_any_ptr(&self) -> bool {
+        self.is_region_ptr() || self.is_unsafe_ptr() || self.is_fn_ptr()
+    }
+
     /// Returns `true` if this type is an `Arc<T>`.
     #[inline]
     pub fn is_arc(&self) -> bool {