Skip to content

Commit 24d806c

Browse files
Stop using is_copy_modulo_regions when building clone shim
1 parent eb7a0f8 commit 24d806c

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

compiler/rustc_mir_transform/src/shim.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -447,16 +447,13 @@ fn build_thread_local_shim<'tcx>(tcx: TyCtxt<'tcx>, instance: ty::InstanceDef<'t
447447
fn build_clone_shim<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, self_ty: Ty<'tcx>) -> Body<'tcx> {
448448
debug!("build_clone_shim(def_id={:?})", def_id);
449449

450-
let param_env = tcx.param_env_reveal_all_normalized(def_id);
451-
452450
let mut builder = CloneShimBuilder::new(tcx, def_id, self_ty);
453-
let is_copy = self_ty.is_copy_modulo_regions(tcx, param_env);
454451

455452
let dest = Place::return_place();
456453
let src = tcx.mk_place_deref(Place::from(Local::new(1 + 0)));
457454

458455
match self_ty.kind() {
459-
_ if is_copy => builder.copy_shim(),
456+
ty::FnDef(..) | ty::FnPtr(_) => builder.copy_shim(),
460457
ty::Closure(_, args) => builder.tuple_like_shim(dest, src, args.as_closure().upvar_tys()),
461458
ty::Tuple(..) => builder.tuple_like_shim(dest, src, self_ty.tuple_fields()),
462459
ty::Coroutine(coroutine_def_id, args) => {

compiler/rustc_ty_utils/src/instance.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,8 @@ fn resolve_associated_item<'tcx>(
209209
let name = tcx.item_name(trait_item_id);
210210
if name == sym::clone {
211211
let self_ty = trait_ref.self_ty();
212-
213-
let is_copy = self_ty.is_copy_modulo_regions(tcx, param_env);
214212
match self_ty.kind() {
215-
_ if is_copy => (),
213+
ty::FnDef(..) | ty::FnPtr(_) => (),
216214
ty::Coroutine(..)
217215
| ty::CoroutineWitness(..)
218216
| ty::Closure(..)

0 commit comments

Comments
 (0)