@@ -582,7 +582,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
582582 match self . confirm_candidate ( obligation, candidate) {
583583 Err ( SelectionError :: Overflow ) => {
584584 assert ! ( self . query_mode == TraitQueryMode :: Canonical ) ;
585- return Err ( SelectionError :: Overflow ) ;
585+ Err ( SelectionError :: Overflow )
586586 } ,
587587 Err ( e) => Err ( e) ,
588588 Ok ( candidate) => Ok ( Some ( candidate) )
@@ -879,7 +879,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
879879 // must be met of course). One obvious case this comes up is
880880 // marker traits like `Send`. Think of a linked list:
881881 //
882- // struct List<T> { data: T, next: Option<Box<List<T>>> {
882+ // struct List<T> { data: T, next: Option<Box<List<T>>> }
883883 //
884884 // `Box<List<T>>` will be `Send` if `T` is `Send` and
885885 // `Option<Box<List<T>>>` is `Send`, and in turn
@@ -1407,7 +1407,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
14071407 stack : & TraitObligationStack < ' o , ' tcx > )
14081408 -> Result < SelectionCandidateSet < ' tcx > , SelectionError < ' tcx > >
14091409 {
1410- let TraitObligationStack { obligation, .. } = * stack;
1410+ let obligation = stack. obligation ;
14111411 let ref obligation = Obligation {
14121412 param_env : obligation. param_env ,
14131413 cause : obligation. cause . clone ( ) ,
@@ -1788,9 +1788,9 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
17881788 }
17891789
17901790 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 > >
17941794 {
17951795 // OK to skip binder here because the tests we do below do not involve bound regions
17961796 let self_ty = * obligation. self_ty ( ) . skip_binder ( ) ;
@@ -2433,7 +2433,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
24332433 fn confirm_candidate ( & mut self ,
24342434 obligation : & TraitObligation < ' tcx > ,
24352435 candidate : SelectionCandidate < ' tcx > )
2436- -> Result < Selection < ' tcx > , SelectionError < ' tcx > >
2436+ -> Result < Selection < ' tcx > , SelectionError < ' tcx > >
24372437 {
24382438 debug ! ( "confirm_candidate({:?}, {:?})" ,
24392439 obligation,
@@ -2612,11 +2612,11 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
26122612 let mut obligations = self . collect_predicates_for_types (
26132613 obligation. param_env ,
26142614 cause,
2615- obligation. recursion_depth + 1 ,
2615+ obligation. recursion_depth + 1 ,
26162616 trait_def_id,
26172617 nested) ;
26182618
2619- let trait_obligations = self . in_snapshot ( |this, snapshot| {
2619+ let trait_obligations: Vec < PredicateObligation < ' _ > > = self . in_snapshot ( |this, snapshot| {
26202620 let poly_trait_ref = obligation. predicate . to_poly_trait_ref ( ) ;
26212621 let ( trait_ref, skol_map) =
26222622 this. infcx ( ) . skolemize_late_bound_regions ( & poly_trait_ref) ;
@@ -2630,6 +2630,8 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
26302630 snapshot)
26312631 } ) ;
26322632
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.
26332635 obligations. extend ( trait_obligations) ;
26342636
26352637 debug ! ( "vtable_auto_impl: obligations={:?}" , obligations) ;
0 commit comments