}
}
- CastKind::PointerAddress => {
+ CastKind::PointerExposeAddress => {
let ty_from = op.ty(body, tcx);
let cast_ty_from = CastTy::from_ty(ty_from);
let cast_ty_to = CastTy::from_ty(*ty);
match (cast_ty_from, cast_ty_to) {
(Some(CastTy::Ptr(_) | CastTy::FnPtr), Some(CastTy::Int(_))) => (),
_ => {
- span_mirbug!(self, rvalue, "Invalid cast {:?} -> {:?}", ty_from, ty)
+ span_mirbug!(
+ self,
+ rvalue,
+ "Invalid PointerExposeAddress cast {:?} -> {:?}",
+ ty_from,
+ ty
+ )
}
}
}
- CastKind::Misc => {
+ CastKind::PointerFromExposedAddress => {
let ty_from = op.ty(body, tcx);
let cast_ty_from = CastTy::from_ty(ty_from);
let cast_ty_to = CastTy::from_ty(*ty);
match (cast_ty_from, cast_ty_to) {
- (None, _)
- | (_, None | Some(CastTy::FnPtr))
- | (Some(CastTy::Float), Some(CastTy::Ptr(_)))
- | (
- Some(CastTy::Ptr(_) | CastTy::FnPtr),
- Some(CastTy::Float | CastTy::Int(_)),
- ) => {
- span_mirbug!(self, rvalue, "Invalid cast {:?} -> {:?}", ty_from, ty,)
+ (Some(CastTy::Int(_)), Some(CastTy::Ptr(_))) => (),
+ _ => {
+ span_mirbug!(
+ self,
+ rvalue,
+ "Invalid PointerFromExposedAddress cast {:?} -> {:?}",
+ ty_from,
+ ty
+ )
}
+ }
+ }
+
+ CastKind::Misc => {
+ let ty_from = op.ty(body, tcx);
+ let cast_ty_from = CastTy::from_ty(ty_from);
+ let cast_ty_to = CastTy::from_ty(*ty);
+ // Misc casts are either between floats and ints, or one ptr type to another.
+ match (cast_ty_from, cast_ty_to) {
(
- Some(CastTy::Int(_)),
- Some(CastTy::Int(_) | CastTy::Float | CastTy::Ptr(_)),
+ Some(CastTy::Int(_) | CastTy::Float),
+ Some(CastTy::Int(_) | CastTy::Float),
)
- | (Some(CastTy::Float), Some(CastTy::Int(_) | CastTy::Float))
| (Some(CastTy::Ptr(_) | CastTy::FnPtr), Some(CastTy::Ptr(_))) => (),
+ _ => {
+ span_mirbug!(
+ self,
+ rvalue,
+ "Invalid Misc cast {:?} -> {:?}",
+ ty_from,
+ ty,
+ )
+ }
}
}
}