@@ -351,9 +351,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
351351 ty_to_bounds
352352 . into_iter ( )
353353 . 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) {
357355 let mut new_path = poly_trait. trait_ . clone ( ) ;
358356 let last_segment = new_path. segments . pop ( ) . expect ( "segments were empty" ) ;
359357
@@ -371,8 +369,9 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
371369 GenericArgs :: Parenthesized { inputs, output } => ( inputs, output) ,
372370 } ;
373371
372+ let output = output. as_ref ( ) . cloned ( ) . map ( Box :: new) ;
374373 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 ) ;
376375 }
377376
378377 let new_params = GenericArgs :: Parenthesized { inputs : old_input, output } ;
@@ -382,7 +381,10 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
382381 . push ( PathSegment { name : last_segment. name , args : new_params } ) ;
383382
384383 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+ } ,
386388 hir:: TraitBoundModifier :: None ,
387389 ) ) ;
388390 }
0 commit comments