1
1
use std:: iter;
2
2
3
3
use rustc_ast_ir:: Mutability ;
4
- use tracing:: { debug , instrument } ;
4
+ use tracing:: { instrument , trace } ;
5
5
6
6
use crate :: error:: { ExpectedFound , TypeError } ;
7
7
use crate :: fold:: TypeFoldable ;
@@ -58,9 +58,6 @@ impl<I: Interner> VarianceDiagInfo<I> {
58
58
pub trait TypeRelation < I : Interner > : Sized {
59
59
fn cx ( & self ) -> I ;
60
60
61
- /// Returns a static string we can use for printouts.
62
- fn tag ( & self ) -> & ' static str ;
63
-
64
61
/// Generic relation routine suitable for most anything.
65
62
fn relate < T : Relate < I > > ( & mut self , a : T , b : T ) -> RelateResult < I , T > {
66
63
Relate :: relate ( self , a, b)
@@ -69,17 +66,13 @@ pub trait TypeRelation<I: Interner>: Sized {
69
66
/// Relate the two args for the given item. The default
70
67
/// is to look up the variance for the item and proceed
71
68
/// accordingly.
69
+ #[ instrument( skip( self ) , level = "trace" ) ]
72
70
fn relate_item_args (
73
71
& mut self ,
74
72
item_def_id : I :: DefId ,
75
73
a_arg : I :: GenericArgs ,
76
74
b_arg : I :: GenericArgs ,
77
75
) -> RelateResult < I , I :: GenericArgs > {
78
- debug ! (
79
- "relate_item_args(item_def_id={:?}, a_arg={:?}, b_arg={:?})" ,
80
- item_def_id, a_arg, b_arg
81
- ) ;
82
-
83
76
let cx = self . cx ( ) ;
84
77
let opt_variances = cx. variances_of ( item_def_id) ;
85
78
relate_args_with_variances ( self , item_def_id, opt_variances, a_arg, b_arg, true )
@@ -571,15 +564,25 @@ pub fn structurally_relate_consts<I: Interner, R: TypeRelation<I>>(
571
564
mut a : I :: Const ,
572
565
mut b : I :: Const ,
573
566
) -> RelateResult < I , I :: Const > {
574
- debug ! ( "{}.structurally_relate_consts(a = {:?}, b = {:?})" , relation. tag( ) , a, b) ;
567
+ trace ! (
568
+ "structurally_relate_consts::<{}>(a = {:?}, b = {:?})" ,
569
+ std:: any:: type_name:: <R >( ) ,
570
+ a,
571
+ b
572
+ ) ;
575
573
let cx = relation. cx ( ) ;
576
574
577
575
if cx. features ( ) . generic_const_exprs ( ) {
578
576
a = cx. expand_abstract_consts ( a) ;
579
577
b = cx. expand_abstract_consts ( b) ;
580
578
}
581
579
582
- debug ! ( "{}.structurally_relate_consts(normed_a = {:?}, normed_b = {:?})" , relation. tag( ) , a, b) ;
580
+ trace ! (
581
+ "structurally_relate_consts::<{}>(normed_a = {:?}, normed_b = {:?})" ,
582
+ std:: any:: type_name:: <R >( ) ,
583
+ a,
584
+ b
585
+ ) ;
583
586
584
587
// Currently, the values that can be unified are primitive types,
585
588
// and those that derive both `PartialEq` and `Eq`, corresponding
0 commit comments