]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/ty/cast.rs
Rollup merge of #68738 - kennytm:derive-clone-eq-for-fromutf8error, r=sfackler
[rust.git] / src / librustc / ty / cast.rs
index bc12412312debcb100a70d0d5f0cbd9bcfb4bdf2..5ba3f80b82296842f8117b555156a8990cc7c5dc 100644 (file)
@@ -3,8 +3,8 @@
 
 use crate::ty::{self, Ty};
 
-use syntax::ast;
 use rustc_macros::HashStable;
+use syntax::ast;
 
 /// Types that are represented as ints.
 #[derive(Copy, Clone, Debug, PartialEq, Eq)]
@@ -13,7 +13,7 @@ pub enum IntTy {
     I,
     CEnum,
     Bool,
-    Char
+    Char,
 }
 
 // Valid types for the result of a non-coercion cast
@@ -28,8 +28,6 @@ pub enum CastTy<'tcx> {
     FnPtr,
     /// Raw pointers
     Ptr(ty::TypeAndMut<'tcx>),
-    /// References
-    RPtr(ty::TypeAndMut<'tcx>),
 }
 
 /// Cast Kind. See RFC 401 (or librustc_typeck/check/cast.rs)
@@ -45,7 +43,7 @@ pub enum CastKind {
     U8CharCast,
     ArrayPtrCast,
     FnPtrPtrCast,
-    FnPtrAddrCast
+    FnPtrAddrCast,
 }
 
 impl<'tcx> CastTy<'tcx> {
@@ -60,10 +58,8 @@ pub fn from_ty(t: Ty<'tcx>) -> Option<CastTy<'tcx>> {
             ty::Infer(ty::InferTy::FloatVar(_)) => Some(CastTy::Float),
             ty::Uint(u) => Some(CastTy::Int(IntTy::U(u))),
             ty::Float(_) => Some(CastTy::Float),
-            ty::Adt(d,_) if d.is_enum() && d.is_payloadfree() =>
-                Some(CastTy::Int(IntTy::CEnum)),
+            ty::Adt(d, _) if d.is_enum() && d.is_payloadfree() => Some(CastTy::Int(IntTy::CEnum)),
             ty::RawPtr(mt) => Some(CastTy::Ptr(mt)),
-            ty::Ref(_, ty, mutbl) => Some(CastTy::RPtr(ty::TypeAndMut { ty, mutbl })),
             ty::FnPtr(..) => Some(CastTy::FnPtr),
             _ => None,
         }