@@ -351,9 +351,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
351
351
ty_to_bounds
352
352
. into_iter ( )
353
353
. flat_map ( |( ty, mut bounds) | {
354
- if let Some ( data) = ty_to_fn. get ( & ty) {
355
- let ( poly_trait, output) =
356
- ( data. 0 . as_ref ( ) . unwrap ( ) . clone ( ) , data. 1 . as_ref ( ) . cloned ( ) . map ( Box :: new) ) ;
354
+ if let Some ( ( Some ( ref poly_trait) , ref output) ) = ty_to_fn. get ( & ty) {
357
355
let mut new_path = poly_trait. trait_ . clone ( ) ;
358
356
let last_segment = new_path. segments . pop ( ) . expect ( "segments were empty" ) ;
359
357
@@ -371,8 +369,9 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
371
369
GenericArgs :: Parenthesized { inputs, output } => ( inputs, output) ,
372
370
} ;
373
371
372
+ let output = output. as_ref ( ) . cloned ( ) . map ( Box :: new) ;
374
373
if old_output. is_some ( ) && old_output != output {
375
- panic ! ( "Output mismatch for {:?} {:?} {:?}" , ty, old_output, data . 1 ) ;
374
+ panic ! ( "Output mismatch for {:?} {:?} {:?}" , ty, old_output, output ) ;
376
375
}
377
376
378
377
let new_params = GenericArgs :: Parenthesized { inputs : old_input, output } ;
@@ -382,7 +381,10 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
382
381
. push ( PathSegment { name : last_segment. name , args : new_params } ) ;
383
382
384
383
bounds. insert ( GenericBound :: TraitBound (
385
- PolyTrait { trait_ : new_path, generic_params : poly_trait. generic_params } ,
384
+ PolyTrait {
385
+ trait_ : new_path,
386
+ generic_params : poly_trait. generic_params . clone ( ) ,
387
+ } ,
386
388
hir:: TraitBoundModifier :: None ,
387
389
) ) ;
388
390
}
0 commit comments