File tree 1 file changed +4
-7
lines changed
1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change 14
14
// - It's not possible to take the address of a static item with unsafe interior. This is enforced
15
15
// by borrowck::gather_loans
16
16
17
- use rustc:: ty:: cast:: CastKind ;
17
+ use rustc:: ty:: cast:: CastTy ;
18
18
use rustc:: hir:: def:: { Def , CtorKind } ;
19
19
use rustc:: hir:: def_id:: DefId ;
20
20
use rustc:: middle:: expr_use_visitor as euv;
@@ -319,12 +319,9 @@ fn check_expr_kind<'a, 'tcx>(
319
319
hir:: ExprKind :: Cast ( ref from, _) => {
320
320
let expr_promotability = v. check_expr ( from) ;
321
321
debug ! ( "Checking const cast(id={})" , from. hir_id) ;
322
- match v. tables . cast_kinds ( ) . get ( from. hir_id ) {
323
- None => {
324
- v. tcx . sess . delay_span_bug ( e. span , "no kind for cast" ) ;
325
- NotPromotable
326
- } ,
327
- Some ( & CastKind :: PtrAddrCast ) | Some ( & CastKind :: FnPtrAddrCast ) => {
322
+ let cast_in = CastTy :: from_ty ( v. tables . expr_ty ( from) ) . expect ( "bad input type for cast" ) ;
323
+ match cast_in {
324
+ CastTy :: FnPtr | CastTy :: Ptr ( _) => {
328
325
NotPromotable
329
326
}
330
327
_ => expr_promotability
You can’t perform that action at this time.
0 commit comments