@@ -312,11 +312,7 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
312312
313313 Status :: Unstable ( gate) if self . tcx . features ( ) . enabled ( gate) => {
314314 let unstable_in_stable = self . ccx . is_const_stable_const_fn ( )
315- && !super :: rustc_allow_const_fn_unstable (
316- self . tcx ,
317- self . def_id ( ) . to_def_id ( ) ,
318- gate,
319- ) ;
315+ && !super :: rustc_allow_const_fn_unstable ( self . tcx , self . def_id ( ) , gate) ;
320316 if unstable_in_stable {
321317 emit_unstable_in_stable_error ( self . ccx , span, gate) ;
322318 }
@@ -713,7 +709,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
713709 match & terminator. kind {
714710 TerminatorKind :: Call { func, args, fn_span, from_hir_call, .. } => {
715711 let ConstCx { tcx, body, param_env, .. } = * self . ccx ;
716- let caller = self . def_id ( ) . to_def_id ( ) ;
712+ let caller = self . def_id ( ) ;
717713
718714 let fn_ty = func. ty ( body, tcx) ;
719715
@@ -797,7 +793,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
797793 // trait.
798794 let callee_trait = tcx. trait_of_item ( callee) ;
799795 if callee_trait. is_some ( )
800- && tcx. has_attr ( caller, sym:: default_method_body_is_const)
796+ && tcx. has_attr ( caller. to_def_id ( ) , sym:: default_method_body_is_const)
801797 && callee_trait == tcx. trait_of_item ( caller)
802798 // Can only call methods when it's `<Self as TheTrait>::f`.
803799 && tcx. types . self_param == substs. type_at ( 0 )
0 commit comments