@@ -120,7 +120,8 @@ impl<'a, 'tcx> FulfillmentContext<'tcx> {
120
120
& mut self ,
121
121
selcx : & mut SelectionContext < ' a , ' tcx > ,
122
122
) -> Result < ( ) , Vec < FulfillmentError < ' tcx > > > {
123
- debug ! ( "select(obligation-forest-size={})" , self . predicates. len( ) ) ;
123
+ let span = debug_span ! ( "select" , obligation_forest_size = ?self . predicates. len( ) ) ;
124
+ let _enter = span. enter ( ) ;
124
125
125
126
let mut errors = Vec :: new ( ) ;
126
127
@@ -173,7 +174,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> {
173
174
projection_ty : ty:: ProjectionTy < ' tcx > ,
174
175
cause : ObligationCause < ' tcx > ,
175
176
) -> Ty < ' tcx > {
176
- debug ! ( "normalize_projection_type(projection_ty={:?})" , projection_ty ) ;
177
+ debug ! ( ?projection_ty , "normalize_projection_type" ) ;
177
178
178
179
debug_assert ! ( !projection_ty. has_escaping_bound_vars( ) ) ;
179
180
@@ -191,7 +192,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> {
191
192
) ;
192
193
self . register_predicate_obligations ( infcx, obligations) ;
193
194
194
- debug ! ( "normalize_projection_type: result={:?}" , normalized_ty) ;
195
+ debug ! ( ? normalized_ty) ;
195
196
196
197
normalized_ty
197
198
}
@@ -205,7 +206,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> {
205
206
// debug output much nicer to read and so on.
206
207
let obligation = infcx. resolve_vars_if_possible ( & obligation) ;
207
208
208
- debug ! ( "register_predicate_obligation(obligation={:?})" , obligation ) ;
209
+ debug ! ( ?obligation , "register_predicate_obligation" ) ;
209
210
210
211
assert ! ( !infcx. is_in_snapshot( ) || self . usable_in_snapshot) ;
211
212
@@ -342,7 +343,7 @@ impl<'a, 'b, 'tcx> FulfillProcessor<'a, 'b, 'tcx> {
342
343
self . selcx . infcx ( ) . resolve_vars_if_possible ( & obligation. predicate ) ;
343
344
}
344
345
345
- debug ! ( "process_obligation: obligation = {:?} cause = {:?}" , obligation, obligation. cause) ;
346
+ debug ! ( ? obligation, ? obligation. cause, "process_obligation" ) ;
346
347
347
348
let infcx = self . selcx . infcx ( ) ;
348
349
@@ -509,7 +510,7 @@ impl<'a, 'b, 'tcx> FulfillProcessor<'a, 'b, 'tcx> {
509
510
}
510
511
511
512
ty:: PredicateAtom :: ConstEquate ( c1, c2) => {
512
- debug ! ( "equating consts: c1={:?} c2={:?}" , c1 , c2 ) ;
513
+ debug ! ( ?c1 , ?c2 , "equating consts" ) ;
513
514
if self . selcx . tcx ( ) . features ( ) . const_evaluatable_checked {
514
515
// FIXME: we probably should only try to unify abstract constants
515
516
// if the constants depend on generic parameters.
@@ -601,6 +602,7 @@ impl<'a, 'b, 'tcx> FulfillProcessor<'a, 'b, 'tcx> {
601
602
}
602
603
}
603
604
605
+ #[ instrument( level = "debug" , skip( self , obligation, stalled_on) ) ]
604
606
fn process_trait_obligation (
605
607
& mut self ,
606
608
obligation : & PredicateObligation < ' tcx > ,
@@ -613,26 +615,20 @@ impl<'a, 'b, 'tcx> FulfillProcessor<'a, 'b, 'tcx> {
613
615
// FIXME: consider caching errors too.
614
616
if infcx. predicate_must_hold_considering_regions ( obligation) {
615
617
debug ! (
616
- "selecting trait `{:?}` at depth {} evaluated to holds" ,
617
- obligation. predicate , obligation . recursion_depth
618
+ "selecting trait at depth {} evaluated to holds" ,
619
+ obligation. recursion_depth
618
620
) ;
619
621
return ProcessResult :: Changed ( vec ! [ ] ) ;
620
622
}
621
623
}
622
624
623
625
match self . selcx . select ( & trait_obligation) {
624
626
Ok ( Some ( impl_source) ) => {
625
- debug ! (
626
- "selecting trait `{:?}` at depth {} yielded Ok(Some)" ,
627
- trait_obligation. predicate, obligation. recursion_depth
628
- ) ;
627
+ debug ! ( "selecting trait at depth {} yielded Ok(Some)" , obligation. recursion_depth) ;
629
628
ProcessResult :: Changed ( mk_pending ( impl_source. nested_obligations ( ) ) )
630
629
}
631
630
Ok ( None ) => {
632
- debug ! (
633
- "selecting trait `{:?}` at depth {} yielded Ok(None)" ,
634
- trait_obligation. predicate, obligation. recursion_depth
635
- ) ;
631
+ debug ! ( "selecting trait at depth {} yielded Ok(None)" , obligation. recursion_depth) ;
636
632
637
633
// This is a bit subtle: for the most part, the
638
634
// only reason we can fail to make progress on
@@ -652,10 +648,7 @@ impl<'a, 'b, 'tcx> FulfillProcessor<'a, 'b, 'tcx> {
652
648
ProcessResult :: Unchanged
653
649
}
654
650
Err ( selection_err) => {
655
- info ! (
656
- "selecting trait `{:?}` at depth {} yielded Err" ,
657
- trait_obligation. predicate, obligation. recursion_depth
658
- ) ;
651
+ info ! ( "selecting trait at depth {} yielded Err" , obligation. recursion_depth) ;
659
652
660
653
ProcessResult :: Error ( CodeSelectionError ( selection_err) )
661
654
}
0 commit comments