@@ -29,7 +29,7 @@ use rustc_target::spec::abi::Abi;
29
29
30
30
use std:: { iter, mem, usize} ;
31
31
32
- use crate :: transform:: check_consts:: { qualifs, Item , ConstKind } ;
32
+ use crate :: transform:: check_consts:: { qualifs, Item , ConstKind , is_lang_panic_fn } ;
33
33
34
34
/// State of a temporary during collection and promotion.
35
35
#[ derive( Copy , Clone , PartialEq , Eq , Debug ) ]
@@ -250,11 +250,6 @@ impl std::ops::Deref for Validator<'a, 'tcx> {
250
250
struct Unpromotable ;
251
251
252
252
impl < ' 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
-
258
253
fn validate_candidate ( & self , candidate : Candidate ) -> Result < ( ) , Unpromotable > {
259
254
match candidate {
260
255
Candidate :: Ref ( loc) => {
@@ -700,7 +695,7 @@ impl<'tcx> Validator<'_, 'tcx> {
700
695
ty:: FnDef ( def_id, _) => {
701
696
self . tcx . is_const_fn ( def_id) ||
702
697
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 )
704
699
}
705
700
_ => false ,
706
701
} ;
0 commit comments