@@ -125,16 +125,11 @@ fn check_rvalue<'tcx>(
125
125
Rvalue :: Len ( place) | Rvalue :: Discriminant ( place) | Rvalue :: Ref ( _, _, place) | Rvalue :: AddressOf ( _, place) => {
126
126
check_place ( tcx, * place, span, body)
127
127
} ,
128
- Rvalue :: Cast ( CastKind :: Misc , operand, cast_ty) => {
129
- use rustc_middle:: ty:: cast:: CastTy ;
130
- let cast_in = CastTy :: from_ty ( operand. ty ( body, tcx) ) . expect ( "bad input type for cast" ) ;
131
- let cast_out = CastTy :: from_ty ( * cast_ty) . expect ( "bad output type for cast" ) ;
132
- match ( cast_in, cast_out) {
133
- ( CastTy :: Ptr ( _) | CastTy :: FnPtr , CastTy :: Int ( _) ) => {
134
- Err ( ( span, "casting pointers to ints is unstable in const fn" . into ( ) ) )
135
- } ,
136
- _ => check_operand ( tcx, operand, span, body) ,
137
- }
128
+ Rvalue :: Cast ( CastKind :: PointerAddress , _, _) => {
129
+ Err ( ( span, "casting pointers to ints is unstable in const fn" . into ( ) ) )
130
+ } ,
131
+ Rvalue :: Cast ( CastKind :: Misc , operand, _) => {
132
+ check_operand ( tcx, operand, span, body)
138
133
} ,
139
134
Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: MutToConstPointer | PointerCast :: ArrayToPointer ) , operand, _) => {
140
135
check_operand ( tcx, operand, span, body)
0 commit comments