about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-02-11 22:13:52 +0000
committerbors <bors@rust-lang.org>2024-02-11 22:13:52 +0000
commit520b0b20aa8c218f84cefc6260f52406b84fa55f (patch)
tree0f5fd18fd5cc421846bba43684e5606ab6048d49 /compiler/rustc_mir_transform/src
parent1a648b397dedc98ada3dd3360f6d661ec2436c56 (diff)
parent24d806ccfa0842f5b65f90a9145fd2439d5c4d34 (diff)
downloadrust-520b0b20aa8c218f84cefc6260f52406b84fa55f.tar.gz
rust-520b0b20aa8c218f84cefc6260f52406b84fa55f.zip
Auto merge of #120619 - compiler-errors:param, r=lcnr
Assert that params with the same *index* have the same *name*

Found this bug when trying to build libcore with the new solver, since it will canonicalize two params with the same index into *different* placeholders if those params differ by name.
Diffstat (limited to 'compiler/rustc_mir_transform/src')
-rw-r--r--compiler/rustc_mir_transform/src/shim.rs5
1 files changed, 1 insertions, 4 deletions
diff --git a/compiler/rustc_mir_transform/src/shim.rs b/compiler/rustc_mir_transform/src/shim.rs
index 7b6de3a5439..860d280be29 100644
--- a/compiler/rustc_mir_transform/src/shim.rs
+++ b/compiler/rustc_mir_transform/src/shim.rs
@@ -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> {
     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 is_copy = self_ty.is_copy_modulo_regions(tcx, param_env);
 
     let dest = Place::return_place();
     let src = tcx.mk_place_deref(Place::from(Local::new(1 + 0)));
 
     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::Tuple(..) => builder.tuple_like_shim(dest, src, self_ty.tuple_fields()),
         ty::Coroutine(coroutine_def_id, args) => {