use crate::ty::{self, Ty};
use syntax::ast;
+use rustc_macros::HashStable;
/// Types that are represented as ints.
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
}
/// Cast Kind. See RFC 401 (or librustc_typeck/check/cast.rs)
-#[derive(Copy, Clone, Debug, RustcEncodable, RustcDecodable)]
+#[derive(Copy, Clone, Debug, RustcEncodable, RustcDecodable, HashStable)]
pub enum CastKind {
CoercionCast,
PtrPtrCast,
/// Returns `Some` for integral/pointer casts.
/// casts like unsizing casts will return `None`
pub fn from_ty(t: Ty<'tcx>) -> Option<CastTy<'tcx>> {
- match t.sty {
+ match t.kind {
ty::Bool => Some(CastTy::Int(IntTy::Bool)),
ty::Char => Some(CastTy::Int(IntTy::Char)),
ty::Int(_) => Some(CastTy::Int(IntTy::I)),