Stop using is_copy_modulo_regions when building clone shim
This commit is contained in:
parent
eb7a0f8eb6
commit
24d806ccfa
2 changed files with 2 additions and 7 deletions
|
@ -447,16 +447,13 @@ fn build_thread_local_shim<'tcx>(tcx: TyCtxt<'tcx>, instance: ty::InstanceDef<'t
|
||||||
fn build_clone_shim<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, self_ty: Ty<'tcx>) -> Body<'tcx> {
|
fn build_clone_shim<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, self_ty: Ty<'tcx>) -> Body<'tcx> {
|
||||||
debug!("build_clone_shim(def_id={:?})", def_id);
|
debug!("build_clone_shim(def_id={:?})", def_id);
|
||||||
|
|
||||||
let param_env = tcx.param_env_reveal_all_normalized(def_id);
|
|
||||||
|
|
||||||
let mut builder = CloneShimBuilder::new(tcx, def_id, self_ty);
|
let mut builder = CloneShimBuilder::new(tcx, def_id, self_ty);
|
||||||
let is_copy = self_ty.is_copy_modulo_regions(tcx, param_env);
|
|
||||||
|
|
||||||
let dest = Place::return_place();
|
let dest = Place::return_place();
|
||||||
let src = tcx.mk_place_deref(Place::from(Local::new(1 + 0)));
|
let src = tcx.mk_place_deref(Place::from(Local::new(1 + 0)));
|
||||||
|
|
||||||
match self_ty.kind() {
|
match self_ty.kind() {
|
||||||
_ if is_copy => builder.copy_shim(),
|
ty::FnDef(..) | ty::FnPtr(_) => builder.copy_shim(),
|
||||||
ty::Closure(_, args) => builder.tuple_like_shim(dest, src, args.as_closure().upvar_tys()),
|
ty::Closure(_, args) => builder.tuple_like_shim(dest, src, args.as_closure().upvar_tys()),
|
||||||
ty::Tuple(..) => builder.tuple_like_shim(dest, src, self_ty.tuple_fields()),
|
ty::Tuple(..) => builder.tuple_like_shim(dest, src, self_ty.tuple_fields()),
|
||||||
ty::Coroutine(coroutine_def_id, args) => {
|
ty::Coroutine(coroutine_def_id, args) => {
|
||||||
|
|
|
@ -209,10 +209,8 @@ fn resolve_associated_item<'tcx>(
|
||||||
let name = tcx.item_name(trait_item_id);
|
let name = tcx.item_name(trait_item_id);
|
||||||
if name == sym::clone {
|
if name == sym::clone {
|
||||||
let self_ty = trait_ref.self_ty();
|
let self_ty = trait_ref.self_ty();
|
||||||
|
|
||||||
let is_copy = self_ty.is_copy_modulo_regions(tcx, param_env);
|
|
||||||
match self_ty.kind() {
|
match self_ty.kind() {
|
||||||
_ if is_copy => (),
|
ty::FnDef(..) | ty::FnPtr(_) => (),
|
||||||
ty::Coroutine(..)
|
ty::Coroutine(..)
|
||||||
| ty::CoroutineWitness(..)
|
| ty::CoroutineWitness(..)
|
||||||
| ty::Closure(..)
|
| ty::Closure(..)
|
||||||
|
|
Loading…
Add table
Reference in a new issue