summary refs log tree commit diff
path: root/compiler/rustc_ty_utils/src
diff options
context:
space:
mode:
authorBen Kimock <kimockb@gmail.com>2024-12-04 21:03:12 -0500
committerBen Kimock <kimockb@gmail.com>2024-12-06 16:42:09 -0500
commit711c8cc690c70d9b4c0e17e90f21f03d4e9d3ebf (patch)
treec2025a7bb0c2a9bf1af448b859b41f5905762cbc /compiler/rustc_ty_utils/src
parent8dc83770f748c6cd16b342889ca2240397c19534 (diff)
downloadrust-711c8cc690c70d9b4c0e17e90f21f03d4e9d3ebf.tar.gz
rust-711c8cc690c70d9b4c0e17e90f21f03d4e9d3ebf.zip
Remove polymorphization
Diffstat (limited to 'compiler/rustc_ty_utils/src')
-rw-r--r--compiler/rustc_ty_utils/src/abi.rs19
1 files changed, 2 insertions, 17 deletions
diff --git a/compiler/rustc_ty_utils/src/abi.rs b/compiler/rustc_ty_utils/src/abi.rs
index 9a625c67ccd..ae6d697794f 100644
--- a/compiler/rustc_ty_utils/src/abi.rs
+++ b/compiler/rustc_ty_utils/src/abi.rs
@@ -45,23 +45,8 @@ fn fn_sig_for_fn_abi<'tcx>(
     let ty = instance.ty(tcx, typing_env);
     match *ty.kind() {
         ty::FnDef(def_id, args) => {
-            // HACK(davidtwco,eddyb): This is a workaround for polymorphization considering
-            // parameters unused if they show up in the signature, but not in the `mir::Body`
-            // (i.e. due to being inside a projection that got normalized, see
-            // `tests/ui/polymorphization/normalized_sig_types.rs`), and codegen not keeping
-            // track of a polymorphization `ParamEnv` to allow normalizing later.
-            //
-            // We normalize the `fn_sig` again after instantiating at a later point.
-            let mut sig = tcx.instantiate_bound_regions_with_erased(
-                tcx.fn_sig(def_id)
-                    .map_bound(|fn_sig| {
-                        tcx.normalize_erasing_regions(
-                            ty::TypingEnv::non_body_analysis(tcx, def_id),
-                            fn_sig,
-                        )
-                    })
-                    .instantiate(tcx, args),
-            );
+            let mut sig = tcx
+                .instantiate_bound_regions_with_erased(tcx.fn_sig(def_id).instantiate(tcx, args));
 
             if let ty::InstanceKind::VTableShim(..) = instance.def {
                 let mut inputs_and_output = sig.inputs_and_output.to_vec();