@@ -18,25 +18,17 @@ pub(crate) fn orphan_check_impl(
1818    let  trait_ref = tcx. impl_trait_ref ( impl_def_id) . unwrap ( ) . instantiate_identity ( ) ; 
1919    trait_ref. error_reported ( ) ?; 
2020
21-     do_orphan_check_impl ( tcx,  trait_ref,  impl_def_id) 
22- } 
23- 
24- fn  do_orphan_check_impl < ' tcx > ( 
25-     tcx :  TyCtxt < ' tcx > , 
26-     trait_ref :  ty:: TraitRef < ' tcx > , 
27-     def_id :  LocalDefId , 
28- )  -> Result < ( ) ,  ErrorGuaranteed >  { 
2921    let  trait_def_id = trait_ref. def_id ; 
3022
31-     match  traits:: orphan_check ( tcx,  def_id . to_def_id ( ) )  { 
23+     match  traits:: orphan_check ( tcx,  impl_def_id . to_def_id ( ) )  { 
3224        Ok ( ( ) )  => { } 
3325        Err ( err)  => { 
34-             let  item = tcx. hir ( ) . expect_item ( def_id ) ; 
26+             let  item = tcx. hir ( ) . expect_item ( impl_def_id ) ; 
3527            let  hir:: ItemKind :: Impl ( impl_)  = item. kind  else  { 
36-                 bug ! ( "{:?} is not an impl: {:?}" ,  def_id ,  item) ; 
28+                 bug ! ( "{:?} is not an impl: {:?}" ,  impl_def_id ,  item) ; 
3729            } ; 
3830            let  tr = impl_. of_trait . as_ref ( ) . unwrap ( ) ; 
39-             let  sp = tcx. def_span ( def_id ) ; 
31+             let  sp = tcx. def_span ( impl_def_id ) ; 
4032
4133            emit_orphan_check_error ( 
4234                tcx, 
@@ -180,7 +172,7 @@ fn do_orphan_check_impl<'tcx>(
180172            // impl<T> AutoTrait for T {} 
181173            // impl<T: ?Sized> AutoTrait for T {} 
182174            ty:: Param ( ..)  => ( 
183-                 if  self_ty. is_sized ( tcx,  tcx. param_env ( def_id ) )  { 
175+                 if  self_ty. is_sized ( tcx,  tcx. param_env ( impl_def_id ) )  { 
184176                    LocalImpl :: Allow 
185177                }  else  { 
186178                    LocalImpl :: Disallow  {  problematic_kind :  "generic type"  } 
@@ -237,7 +229,7 @@ fn do_orphan_check_impl<'tcx>(
237229            | ty:: Bound ( ..) 
238230            | ty:: Placeholder ( ..) 
239231            | ty:: Infer ( ..)  => { 
240-                 let  sp = tcx. def_span ( def_id ) ; 
232+                 let  sp = tcx. def_span ( impl_def_id ) ; 
241233                span_bug ! ( sp,  "weird self type for autotrait impl" ) 
242234            } 
243235
@@ -249,7 +241,7 @@ fn do_orphan_check_impl<'tcx>(
249241                LocalImpl :: Allow  => { } 
250242                LocalImpl :: Disallow  {  problematic_kind }  => { 
251243                    return  Err ( tcx. dcx ( ) . emit_err ( errors:: TraitsWithDefaultImpl  { 
252-                         span :  tcx. def_span ( def_id ) , 
244+                         span :  tcx. def_span ( impl_def_id ) , 
253245                        traits :  tcx. def_path_str ( trait_def_id) , 
254246                        problematic_kind, 
255247                        self_ty, 
@@ -261,13 +253,13 @@ fn do_orphan_check_impl<'tcx>(
261253                NonlocalImpl :: Allow  => { } 
262254                NonlocalImpl :: DisallowBecauseNonlocal  => { 
263255                    return  Err ( tcx. dcx ( ) . emit_err ( errors:: CrossCrateTraitsDefined  { 
264-                         span :  tcx. def_span ( def_id ) , 
256+                         span :  tcx. def_span ( impl_def_id ) , 
265257                        traits :  tcx. def_path_str ( trait_def_id) , 
266258                    } ) ) ; 
267259                } 
268260                NonlocalImpl :: DisallowOther  => { 
269261                    return  Err ( tcx. dcx ( ) . emit_err ( errors:: CrossCrateTraits  { 
270-                         span :  tcx. def_span ( def_id ) , 
262+                         span :  tcx. def_span ( impl_def_id ) , 
271263                        traits :  tcx. def_path_str ( trait_def_id) , 
272264                        self_ty, 
273265                    } ) ) ; 
0 commit comments