diff --git a/src/librustc/ty/cast.rs b/src/librustc/ty/cast.rs index c118b7a4692e5..3ba79d91964ab 100644 --- a/src/librustc/ty/cast.rs +++ b/src/librustc/ty/cast.rs @@ -20,7 +20,6 @@ use syntax::ast; pub enum IntTy { U(ast::UintTy), I, - Ivar, CEnum, Bool, Char @@ -64,7 +63,7 @@ impl<'tcx> CastTy<'tcx> { ty::TyBool => Some(CastTy::Int(IntTy::Bool)), ty::TyChar => Some(CastTy::Int(IntTy::Char)), ty::TyInt(_) => Some(CastTy::Int(IntTy::I)), - ty::TyInfer(ty::InferTy::IntVar(_)) => Some(CastTy::Int(IntTy::Ivar)), + ty::TyInfer(ty::InferTy::IntVar(_)) => Some(CastTy::Int(IntTy::I)), ty::TyInfer(ty::InferTy::FloatVar(_)) => Some(CastTy::Float), ty::TyUint(u) => Some(CastTy::Int(IntTy::U(u))), ty::TyFloat(_) => Some(CastTy::Float), diff --git a/src/librustc_typeck/check/cast.rs b/src/librustc_typeck/check/cast.rs index 48bd7b14fc96a..b157dfc0d8a1e 100644 --- a/src/librustc_typeck/check/cast.rs +++ b/src/librustc_typeck/check/cast.rs @@ -392,8 +392,8 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> { } pub fn check(mut self, fcx: &FnCtxt<'a, 'gcx, 'tcx>) { - self.expr_ty = fcx.structurally_resolved_type(self.span, self.expr_ty); - self.cast_ty = fcx.structurally_resolved_type(self.span, self.cast_ty); + self.expr_ty = fcx.resolve_type_vars_if_possible(&self.expr_ty); + self.cast_ty = fcx.resolve_type_vars_if_possible(&self.cast_ty); debug!("check_cast({}, {:?} as {:?})", self.expr.id, @@ -488,11 +488,7 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> { ty::TypeVariants::TyInfer(t) => { match t { ty::InferTy::IntVar(_) | - ty::InferTy::FloatVar(_) | - ty::InferTy::FreshIntTy(_) | - ty::InferTy::FreshFloatTy(_) => { - Err(CastError::NeedDeref) - } + ty::InferTy::FloatVar(_) => Err(CastError::NeedDeref), _ => Err(CastError::NeedViaPtr), } }