- Rvalue::Cast(kind, operand, cast_ty) => {
- if matches!(kind, CastKind::Misc) {
- let operand_ty = operand.ty(self.body, self.tcx);
- let cast_in = CastTy::from_ty(operand_ty).expect("bad input type for cast");
- let cast_out = CastTy::from_ty(*cast_ty).expect("bad output type for cast");
- if let (CastTy::Ptr(_) | CastTy::FnPtr, CastTy::Int(_)) = (cast_in, cast_out) {
- // ptr-to-int casts are not possible in consts and thus not promotable
- return Err(Unpromotable);
- }
- // int-to-ptr casts are fine, they just use the integer value at pointer type.
- }
+ // ptr-to-int casts are not possible in consts and thus not promotable
+ Rvalue::Cast(CastKind::PointerExposeAddress, _, _) => return Err(Unpromotable),