@@ -99,16 +99,15 @@ fn make_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
9999 ty:: InstanceDef :: DropGlue ( def_id, ty) => {
100100 build_drop_shim ( tcx, def_id, ty)
101101 }
102- ty:: InstanceDef :: BuiltinShim ( def_id, ty) => {
102+ ty:: InstanceDef :: CloneShim ( def_id, ty) => {
103103 let name = tcx. item_name ( def_id) . as_str ( ) ;
104- let trait_id = tcx. trait_of_item ( def_id) ;
105- if trait_id == tcx. lang_items . clone_trait ( ) && name == "clone" {
104+ if name == "clone" {
106105 build_clone_shim ( tcx, def_id, ty)
107- } else if trait_id == tcx . lang_items . clone_trait ( ) && name == "clone_from" {
106+ } else if name == "clone_from" {
108107 debug ! ( "make_shim({:?}: using default trait implementation" , instance) ;
109108 return tcx. optimized_mir ( def_id) ;
110109 } else {
111- bug ! ( "builtin shim {:?} not supported" , instance)
110+ bug ! ( "builtin clone shim {:?} not supported" , instance)
112111 }
113112 }
114113 ty:: InstanceDef :: Intrinsic ( _) => {
@@ -272,10 +271,10 @@ impl<'a, 'tcx> DropElaborator<'a, 'tcx> for DropShimElaborator<'a, 'tcx> {
272271 }
273272}
274273
275- /// Build a `Clone::clone` shim for `recvr_ty `. Here, `def_id` is `Clone::clone`.
274+ /// Build a `Clone::clone` shim for `self_ty `. Here, `def_id` is `Clone::clone`.
276275fn build_clone_shim < ' a , ' tcx > ( tcx : ty:: TyCtxt < ' a , ' tcx , ' tcx > ,
277276 def_id : DefId ,
278- rcvr_ty : ty:: Ty < ' tcx > )
277+ self_ty : ty:: Ty < ' tcx > )
279278 -> Mir < ' tcx >
280279{
281280 let sig = tcx. fn_sig ( def_id) ;
@@ -348,7 +347,7 @@ fn build_clone_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
348347 loc
349348 } ;
350349
351- match rcvr_ty . sty {
350+ match self_ty . sty {
352351 ty:: TyArray ( ty, len) => {
353352 let mut returns = Vec :: new ( ) ;
354353 for i in 0 ..len {
0 commit comments