]> git.lizzy.rs Git - rust.git/commitdiff
Skip the pointless tupling/untupling of argument types in trans_closure
authorBjörn Steinbrink <bsteinbr@gmail.com>
Thu, 2 Jul 2015 16:11:24 +0000 (18:11 +0200)
committerBjörn Steinbrink <bsteinbr@gmail.com>
Thu, 2 Jul 2015 16:34:54 +0000 (18:34 +0200)
The tupling only happens for actual closures, same for the untupling.
The only code that actually sees the tupled types is some debugging
output for which it is actually rather confusing to have the types
tupled, because neither the function signature in Rust nor the
function signature for LLVM has them tupled.

src/librustc_trans/trans/base.rs

index 156d591b909f440a463838a24ca28a3b27f2698f..37302ceb61393dd8e43b57a58a2cf0e3a6e935fe 100644 (file)
@@ -1578,16 +1578,6 @@ pub fn trans_closure<'a, 'b, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
         decl.inputs.iter()
                    .map(|arg| node_id_type(bcx, arg.id))
                    .collect::<Vec<_>>();
-    let monomorphized_arg_types = match closure_env {
-        closure::ClosureEnv::NotClosure => {
-            monomorphized_arg_types
-        }
-
-        // Tuple up closure argument types for the "rust-call" ABI.
-        closure::ClosureEnv::Closure(_) => {
-            vec![ccx.tcx().mk_tup(monomorphized_arg_types)]
-        }
-    };
     for monomorphized_arg_type in &monomorphized_arg_types {
         debug!("trans_closure: monomorphized_arg_type: {:?}",
                monomorphized_arg_type);
@@ -1600,8 +1590,7 @@ pub fn trans_closure<'a, 'b, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
             create_datums_for_fn_args_under_call_abi(bcx, arg_scope, &monomorphized_arg_types[..])
         }
         _ => {
-            let arg_tys = untuple_arguments_if_necessary(ccx, &monomorphized_arg_types, abi);
-            create_datums_for_fn_args(bcx, &arg_tys)
+            create_datums_for_fn_args(bcx, &monomorphized_arg_types)
         }
     };