@@ -29,7 +29,7 @@ use rustc_target::spec::abi::Abi;
2929
3030use std:: { iter, mem, usize} ;
3131
32- use crate :: transform:: check_consts:: { qualifs, Item , ConstKind } ;
32+ use crate :: transform:: check_consts:: { qualifs, Item , ConstKind , is_lang_panic_fn } ;
3333
3434/// State of a temporary during collection and promotion.
3535#[ derive( Copy , Clone , PartialEq , Eq , Debug ) ]
@@ -250,11 +250,6 @@ impl std::ops::Deref for Validator<'a, 'tcx> {
250250struct Unpromotable ;
251251
252252impl < ' tcx > Validator < ' _ , ' tcx > {
253- fn is_const_panic_fn ( & self , def_id : DefId ) -> bool {
254- Some ( def_id) == self . tcx . lang_items ( ) . panic_fn ( ) ||
255- Some ( def_id) == self . tcx . lang_items ( ) . begin_panic_fn ( )
256- }
257-
258253 fn validate_candidate ( & self , candidate : Candidate ) -> Result < ( ) , Unpromotable > {
259254 match candidate {
260255 Candidate :: Ref ( loc) => {
@@ -700,7 +695,7 @@ impl<'tcx> Validator<'_, 'tcx> {
700695 ty:: FnDef ( def_id, _) => {
701696 self . tcx . is_const_fn ( def_id) ||
702697 self . tcx . is_unstable_const_fn ( def_id) . is_some ( ) ||
703- self . is_const_panic_fn ( def_id)
698+ is_lang_panic_fn ( self . tcx , self . def_id )
704699 }
705700 _ => false ,
706701 } ;
0 commit comments