Skip to content

Commit 10811c8

Browse files
committed
---
yaml --- r: 228025 b: refs/heads/try c: 6b5edd2 h: refs/heads/master i: 228023: 9129abd v: v3
1 parent 0632064 commit 10811c8

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: aca2057ed5fb7af3f8905b2bc01f72fa001c35c8
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4-
refs/heads/try: 95c08e37872da325bb785ee4832f5cc4709c2860
4+
refs/heads/try: 6b5edd24f54041b0bb1acafbcf3ccb77868be816
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/src/librustc_trans/trans/type_of.rs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,11 @@ pub fn type_of_explicit_arg<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
5454
}
5555
}
5656

57-
/// Yields the types of the "real" arguments for this function. For most
58-
/// functions, these are simply the types of the arguments. For functions with
59-
/// the `RustCall` ABI, however, this untuples the arguments of the function.
60-
pub fn untuple_arguments_if_necessary<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
61-
inputs: &[Ty<'tcx>],
62-
abi: abi::Abi)
63-
-> Vec<Ty<'tcx>> {
64-
if abi != abi::RustCall {
65-
return inputs.iter().cloned().collect()
66-
}
67-
57+
/// Yields the types of the "real" arguments for a function using the `RustCall`
58+
/// ABI by untupling the arguments of the function.
59+
pub fn untuple_arguments<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
60+
inputs: &[Ty<'tcx>])
61+
-> Vec<Ty<'tcx>> {
6862
if inputs.is_empty() {
6963
return Vec::new()
7064
}
@@ -78,7 +72,7 @@ pub fn untuple_arguments_if_necessary<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
7872

7973
match inputs[inputs.len() - 1].sty {
8074
ty::TyTuple(ref tupled_arguments) => {
81-
debug!("untuple_arguments_if_necessary(): untupling arguments");
75+
debug!("untuple_arguments(): untupling arguments");
8276
for &tupled_argument in tupled_arguments {
8377
result.push(tupled_argument);
8478
}
@@ -108,7 +102,11 @@ pub fn type_of_rust_fn<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
108102
let mut atys: Vec<Type> = Vec::new();
109103

110104
// First, munge the inputs, if this has the `rust-call` ABI.
111-
let inputs = untuple_arguments_if_necessary(cx, &sig.inputs, abi);
105+
let inputs = &if abi == abi::RustCall {
106+
untuple_arguments(cx, &sig.inputs)
107+
} else {
108+
sig.inputs
109+
};
112110

113111
// Arg 0: Output pointer.
114112
// (if the output type is non-immediate)
@@ -136,7 +134,7 @@ pub fn type_of_rust_fn<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
136134
}
137135

138136
// ... then explicit args.
139-
for input in &inputs {
137+
for input in inputs {
140138
let arg_ty = type_of_explicit_arg(cx, input);
141139

142140
if type_is_fat_ptr(cx.tcx(), input) {

0 commit comments

Comments
 (0)