@@ -312,11 +312,7 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
312
312
313
313
Status :: Unstable ( gate) if self . tcx . features ( ) . enabled ( gate) => {
314
314
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) ;
320
316
if unstable_in_stable {
321
317
emit_unstable_in_stable_error ( self . ccx , span, gate) ;
322
318
}
@@ -713,7 +709,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
713
709
match & terminator. kind {
714
710
TerminatorKind :: Call { func, args, fn_span, from_hir_call, .. } => {
715
711
let ConstCx { tcx, body, param_env, .. } = * self . ccx ;
716
- let caller = self . def_id ( ) . to_def_id ( ) ;
712
+ let caller = self . def_id ( ) ;
717
713
718
714
let fn_ty = func. ty ( body, tcx) ;
719
715
@@ -797,7 +793,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
797
793
// trait.
798
794
let callee_trait = tcx. trait_of_item ( callee) ;
799
795
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)
801
797
&& callee_trait == tcx. trait_of_item ( caller)
802
798
// Can only call methods when it's `<Self as TheTrait>::f`.
803
799
&& tcx. types . self_param == substs. type_at ( 0 )
0 commit comments