File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change 1414// - It's not possible to take the address of a static item with unsafe interior. This is enforced
1515// by borrowck::gather_loans
1616
17- use rustc:: ty:: cast:: CastKind ;
17+ use rustc:: ty:: cast:: CastTy ;
1818use rustc:: hir:: def:: { Def , CtorKind } ;
1919use rustc:: hir:: def_id:: DefId ;
2020use rustc:: middle:: expr_use_visitor as euv;
@@ -319,12 +319,9 @@ fn check_expr_kind<'a, 'tcx>(
319319 hir:: ExprKind :: Cast ( ref from, _) => {
320320 let expr_promotability = v. check_expr ( from) ;
321321 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 ( _) => {
328325 NotPromotable
329326 }
330327 _ => expr_promotability
You can’t perform that action at this time.
0 commit comments