@@ -345,13 +345,13 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
345
345
fn make_final_bounds (
346
346
& self ,
347
347
ty_to_bounds : FxHashMap < Type , FxHashSet < GenericBound > > ,
348
- ty_to_fn : FxHashMap < Type , ( Option < PolyTrait > , Option < Type > ) > ,
348
+ ty_to_fn : FxHashMap < Type , ( PolyTrait , Option < Type > ) > ,
349
349
lifetime_to_bounds : FxHashMap < Lifetime , FxHashSet < GenericBound > > ,
350
350
) -> Vec < WherePredicate > {
351
351
ty_to_bounds
352
352
. into_iter ( )
353
353
. flat_map ( |( ty, mut bounds) | {
354
- if let Some ( ( Some ( ref poly_trait) , ref output) ) = ty_to_fn. get ( & ty) {
354
+ if let Some ( ( ref poly_trait, ref output) ) = ty_to_fn. get ( & ty) {
355
355
let mut new_path = poly_trait. trait_ . clone ( ) ;
356
356
let last_segment = new_path. segments . pop ( ) . expect ( "segments were empty" ) ;
357
357
@@ -470,7 +470,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
470
470
let mut lifetime_to_bounds: FxHashMap < _ , FxHashSet < _ > > = Default :: default ( ) ;
471
471
let mut ty_to_traits: FxHashMap < Type , FxHashSet < Path > > = Default :: default ( ) ;
472
472
473
- let mut ty_to_fn: FxHashMap < Type , ( Option < PolyTrait > , Option < Type > ) > = Default :: default ( ) ;
473
+ let mut ty_to_fn: FxHashMap < Type , ( PolyTrait , Option < Type > ) > = Default :: default ( ) ;
474
474
475
475
for p in clean_where_predicates {
476
476
let ( orig_p, p) = ( p, p. clean ( self . cx ) ) ;
@@ -534,8 +534,8 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
534
534
if is_fn {
535
535
ty_to_fn
536
536
. entry ( ty. clone ( ) )
537
- . and_modify ( |e| * e = ( Some ( poly_trait. clone ( ) ) , e. 1 . clone ( ) ) )
538
- . or_insert ( ( ( Some ( poly_trait. clone ( ) ) ) , None ) ) ;
537
+ . and_modify ( |e| * e = ( poly_trait. clone ( ) , e. 1 . clone ( ) ) )
538
+ . or_insert ( ( ( poly_trait. clone ( ) ) , None ) ) ;
539
539
540
540
ty_to_bounds. entry ( ty. clone ( ) ) . or_default ( ) ;
541
541
} else {
@@ -558,7 +558,13 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
558
558
. and_modify ( |e| {
559
559
* e = ( e. 0 . clone ( ) , Some ( rhs. ty ( ) . unwrap ( ) . clone ( ) ) )
560
560
} )
561
- . or_insert ( ( None , Some ( rhs. ty ( ) . unwrap ( ) . clone ( ) ) ) ) ;
561
+ . or_insert ( (
562
+ PolyTrait {
563
+ trait_ : trait_. clone ( ) ,
564
+ generic_params : Vec :: new ( ) ,
565
+ } ,
566
+ Some ( rhs. ty ( ) . unwrap ( ) . clone ( ) ) ,
567
+ ) ) ;
562
568
continue ;
563
569
}
564
570
0 commit comments