File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed
rustc_mir/src/transform/check_consts Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -1179,6 +1179,7 @@ impl<'tcx> PolyFnSig<'tcx> {
11791179 pub fn abi ( & self ) -> abi:: Abi {
11801180 self . skip_binder ( ) . abi
11811181 }
1182+ pub fn constness ( & self ) -> hir:: Constness { self . skip_binder ( ) . constness }
11821183}
11831184
11841185pub type CanonicalPolyFnSig < ' tcx > = Canonical < ' tcx , Binder < FnSig < ' tcx > > > ;
Original file line number Diff line number Diff line change @@ -745,7 +745,10 @@ impl Visitor<'tcx> for Validator<'mir, 'tcx> {
745745 let ( mut callee, substs) = match * fn_ty. kind ( ) {
746746 ty:: FnDef ( def_id, substs) => ( def_id, substs) ,
747747
748- ty:: FnPtr ( _) => {
748+ ty:: FnPtr ( fn_sig) => {
749+ // At this point, we are calling a function by raw pointer because
750+ // we know that it is const
751+ if fn_sig. constness ( ) == hir:: Constness :: Const { return ; }
749752 self . check_op ( ops:: FnCallIndirect ) ;
750753 return ;
751754 }
You can’t perform that action at this time.
0 commit comments