@@ -237,7 +237,7 @@ pub fn trait_ref_is_local_or_fundamental<'tcx>(
237237}
238238
239239pub enum OrphanCheckErr < ' tcx > {
240- NonLocalInputType ( Vec < Ty < ' tcx > > ) ,
240+ NonLocalInputType ( Vec < ( Ty < ' tcx > , usize ) > ) ,
241241 UncoveredTy ( Ty < ' tcx > ) ,
242242}
243243
@@ -391,8 +391,10 @@ fn orphan_check_trait_ref<'tcx>(
391391 }
392392
393393 let mut non_local_spans = vec ! [ ] ;
394- for input_ty in
395- trait_ref. input_types ( ) . flat_map ( |ty| uncover_fundamental_ty ( tcx, ty, in_crate) )
394+ for ( i, input_ty) in trait_ref
395+ . input_types ( )
396+ . flat_map ( |ty| uncover_fundamental_ty ( tcx, ty, in_crate) )
397+ . enumerate ( )
396398 {
397399 debug ! ( "orphan_check_trait_ref: check ty `{:?}`" , input_ty) ;
398400 if ty_is_local ( tcx, input_ty, in_crate) {
@@ -402,7 +404,7 @@ fn orphan_check_trait_ref<'tcx>(
402404 debug ! ( "orphan_check_trait_ref: uncovered ty: `{:?}`" , input_ty) ;
403405 return Err ( OrphanCheckErr :: UncoveredTy ( input_ty) )
404406 }
405- non_local_spans. push ( input_ty) ;
407+ non_local_spans. push ( ( input_ty, i ) ) ;
406408 }
407409 // If we exit above loop, never found a local type.
408410 debug ! ( "orphan_check_trait_ref: no local type" ) ;
@@ -413,7 +415,7 @@ fn orphan_check_trait_ref<'tcx>(
413415 // parameters to the trait, with the self type appearing
414416 // first. Find the first input type that either references a
415417 // type parameter OR some local type.
416- for input_ty in trait_ref. input_types ( ) {
418+ for ( i , input_ty) in trait_ref. input_types ( ) . enumerate ( ) {
417419 if ty_is_local ( tcx, input_ty, in_crate) {
418420 debug ! ( "orphan_check_trait_ref: ty_is_local `{:?}`" , input_ty) ;
419421
@@ -442,7 +444,7 @@ fn orphan_check_trait_ref<'tcx>(
442444 return Err ( OrphanCheckErr :: UncoveredTy ( param) ) ;
443445 }
444446
445- non_local_spans. push ( input_ty) ;
447+ non_local_spans. push ( ( input_ty, i ) ) ;
446448 }
447449 // If we exit above loop, never found a local type.
448450 debug ! ( "orphan_check_trait_ref: no local type" ) ;
0 commit comments