File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -504,6 +504,14 @@ impl<'tcx> EntryKind<'tcx> {
504
504
EntryKind :: Closure ( _) => return None ,
505
505
} )
506
506
}
507
+ fn is_const_fn ( & self , meta : & CrateMetadata ) -> bool {
508
+ let constness = match * self {
509
+ EntryKind :: Method ( data) => data. decode ( meta) . fn_data . constness ,
510
+ EntryKind :: Fn ( data) => data. decode ( meta) . constness ,
511
+ _ => hir:: Constness :: NotConst ,
512
+ } ;
513
+ constness == hir:: Constness :: Const
514
+ }
507
515
}
508
516
509
517
impl < ' a , ' tcx > CrateMetadata {
@@ -1051,12 +1059,7 @@ impl<'a, 'tcx> CrateMetadata {
1051
1059
}
1052
1060
1053
1061
pub fn is_const_fn ( & self , id : DefIndex ) -> bool {
1054
- let constness = match self . entry ( id) . kind {
1055
- EntryKind :: Method ( data) => data. decode ( self ) . fn_data . constness ,
1056
- EntryKind :: Fn ( data) => data. decode ( self ) . constness ,
1057
- _ => hir:: Constness :: NotConst ,
1058
- } ;
1059
- constness == hir:: Constness :: Const
1062
+ self . entry ( id) . kind . is_const_fn ( self )
1060
1063
}
1061
1064
1062
1065
pub fn is_foreign_item ( & self , id : DefIndex ) -> bool {
You can’t perform that action at this time.
0 commit comments