@@ -173,6 +173,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
173
173
174
174
let needs_infer = stack. obligation . predicate . has_infer_types_or_consts ( ) ;
175
175
176
+ let sized_predicate = self . tcx ( ) . lang_items ( ) . sized_trait ( )
177
+ == Some ( stack. obligation . predicate . skip_binder ( ) . def_id ( ) ) ;
178
+
176
179
// If there are STILL multiple candidates, we can further
177
180
// reduce the list by dropping duplicates -- including
178
181
// resolving specializations.
@@ -181,6 +184,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
181
184
while i < candidates. len ( ) {
182
185
let is_dup = ( 0 ..candidates. len ( ) ) . filter ( |& j| i != j) . any ( |j| {
183
186
self . candidate_should_be_dropped_in_favor_of (
187
+ sized_predicate,
184
188
& candidates[ i] ,
185
189
& candidates[ j] ,
186
190
needs_infer,
@@ -338,13 +342,12 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
338
342
Ok ( candidates)
339
343
}
340
344
345
+ #[ tracing:: instrument( level = "debug" , skip( self , candidates) ) ]
341
346
fn assemble_candidates_from_projected_tys (
342
347
& mut self ,
343
348
obligation : & TraitObligation < ' tcx > ,
344
349
candidates : & mut SelectionCandidateSet < ' tcx > ,
345
350
) {
346
- debug ! ( ?obligation, "assemble_candidates_from_projected_tys" ) ;
347
-
348
351
// Before we go into the whole placeholder thing, just
349
352
// quickly check if the self-type is a projection at all.
350
353
match obligation. predicate . skip_binder ( ) . trait_ref . self_ty ( ) . kind ( ) {
@@ -369,12 +372,13 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
369
372
/// supplied to find out whether it is listed among them.
370
373
///
371
374
/// Never affects the inference environment.
375
+ #[ tracing:: instrument( level = "debug" , skip( self , stack, candidates) ) ]
372
376
fn assemble_candidates_from_caller_bounds < ' o > (
373
377
& mut self ,
374
378
stack : & TraitObligationStack < ' o , ' tcx > ,
375
379
candidates : & mut SelectionCandidateSet < ' tcx > ,
376
380
) -> Result < ( ) , SelectionError < ' tcx > > {
377
- debug ! ( ?stack. obligation, "assemble_candidates_from_caller_bounds" ) ;
381
+ debug ! ( ?stack. obligation) ;
378
382
379
383
let all_bounds = stack
380
384
. obligation
@@ -876,14 +880,15 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
876
880
} ;
877
881
}
878
882
883
+ #[ tracing:: instrument( level = "debug" , skip( self , obligation, candidates) ) ]
879
884
fn assemble_candidates_for_trait_alias (
880
885
& mut self ,
881
886
obligation : & TraitObligation < ' tcx > ,
882
887
candidates : & mut SelectionCandidateSet < ' tcx > ,
883
888
) {
884
889
// Okay to skip binder here because the tests we do below do not involve bound regions.
885
890
let self_ty = obligation. self_ty ( ) . skip_binder ( ) ;
886
- debug ! ( ?self_ty, "assemble_candidates_for_trait_alias" ) ;
891
+ debug ! ( ?self_ty) ;
887
892
888
893
let def_id = obligation. predicate . def_id ( ) ;
889
894
@@ -894,21 +899,20 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
894
899
895
900
/// Assembles the trait which are built-in to the language itself:
896
901
/// `Copy`, `Clone` and `Sized`.
902
+ #[ tracing:: instrument( level = "debug" , skip( self , candidates) ) ]
897
903
fn assemble_builtin_bound_candidates (
898
904
& mut self ,
899
905
conditions : BuiltinImplConditions < ' tcx > ,
900
906
candidates : & mut SelectionCandidateSet < ' tcx > ,
901
907
) {
902
908
match conditions {
903
909
BuiltinImplConditions :: Where ( nested) => {
904
- debug ! ( ?nested, "builtin_bound" ) ;
905
910
candidates
906
911
. vec
907
912
. push ( BuiltinCandidate { has_nested : !nested. skip_binder ( ) . is_empty ( ) } ) ;
908
913
}
909
914
BuiltinImplConditions :: None => { }
910
915
BuiltinImplConditions :: Ambiguous => {
911
- debug ! ( "assemble_builtin_bound_candidates: ambiguous builtin" ) ;
912
916
candidates. ambiguous = true ;
913
917
}
914
918
}
0 commit comments