@@ -582,7 +582,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
582
582
match self . confirm_candidate ( obligation, candidate) {
583
583
Err ( SelectionError :: Overflow ) => {
584
584
assert ! ( self . query_mode == TraitQueryMode :: Canonical ) ;
585
- return Err ( SelectionError :: Overflow ) ;
585
+ Err ( SelectionError :: Overflow )
586
586
} ,
587
587
Err ( e) => Err ( e) ,
588
588
Ok ( candidate) => Ok ( Some ( candidate) )
@@ -879,7 +879,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
879
879
// must be met of course). One obvious case this comes up is
880
880
// marker traits like `Send`. Think of a linked list:
881
881
//
882
- // struct List<T> { data: T, next: Option<Box<List<T>>> {
882
+ // struct List<T> { data: T, next: Option<Box<List<T>>> }
883
883
//
884
884
// `Box<List<T>>` will be `Send` if `T` is `Send` and
885
885
// `Option<Box<List<T>>>` is `Send`, and in turn
@@ -1407,7 +1407,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
1407
1407
stack : & TraitObligationStack < ' o , ' tcx > )
1408
1408
-> Result < SelectionCandidateSet < ' tcx > , SelectionError < ' tcx > >
1409
1409
{
1410
- let TraitObligationStack { obligation, .. } = * stack;
1410
+ let obligation = stack. obligation ;
1411
1411
let ref obligation = Obligation {
1412
1412
param_env : obligation. param_env ,
1413
1413
cause : obligation. cause . clone ( ) ,
@@ -1788,9 +1788,9 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
1788
1788
}
1789
1789
1790
1790
fn assemble_candidates_from_auto_impls ( & mut self ,
1791
- obligation : & TraitObligation < ' tcx > ,
1792
- candidates : & mut SelectionCandidateSet < ' tcx > )
1793
- -> Result < ( ) , SelectionError < ' tcx > >
1791
+ obligation : & TraitObligation < ' tcx > ,
1792
+ candidates : & mut SelectionCandidateSet < ' tcx > )
1793
+ -> Result < ( ) , SelectionError < ' tcx > >
1794
1794
{
1795
1795
// OK to skip binder here because the tests we do below do not involve bound regions
1796
1796
let self_ty = * obligation. self_ty ( ) . skip_binder ( ) ;
@@ -2433,7 +2433,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
2433
2433
fn confirm_candidate ( & mut self ,
2434
2434
obligation : & TraitObligation < ' tcx > ,
2435
2435
candidate : SelectionCandidate < ' tcx > )
2436
- -> Result < Selection < ' tcx > , SelectionError < ' tcx > >
2436
+ -> Result < Selection < ' tcx > , SelectionError < ' tcx > >
2437
2437
{
2438
2438
debug ! ( "confirm_candidate({:?}, {:?})" ,
2439
2439
obligation,
@@ -2612,11 +2612,11 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
2612
2612
let mut obligations = self . collect_predicates_for_types (
2613
2613
obligation. param_env ,
2614
2614
cause,
2615
- obligation. recursion_depth + 1 ,
2615
+ obligation. recursion_depth + 1 ,
2616
2616
trait_def_id,
2617
2617
nested) ;
2618
2618
2619
- let trait_obligations = self . in_snapshot ( |this, snapshot| {
2619
+ let trait_obligations: Vec < PredicateObligation < ' _ > > = self . in_snapshot ( |this, snapshot| {
2620
2620
let poly_trait_ref = obligation. predicate . to_poly_trait_ref ( ) ;
2621
2621
let ( trait_ref, skol_map) =
2622
2622
this. infcx ( ) . skolemize_late_bound_regions ( & poly_trait_ref) ;
@@ -2630,6 +2630,8 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
2630
2630
snapshot)
2631
2631
} ) ;
2632
2632
2633
+ // Adds the predicates from the trait. Note that this contains a `Self: Trait`
2634
+ // predicate as usual. It won't have any effect since auto traits are coinductive.
2633
2635
obligations. extend ( trait_obligations) ;
2634
2636
2635
2637
debug ! ( "vtable_auto_impl: obligations={:?}" , obligations) ;
0 commit comments