Skip to content

Commit b69090f

Browse files
committed
---
yaml --- r: 219783 b: refs/heads/snap-stage3 c: 6b5edd2 h: refs/heads/master i: 219781: dac08b2 219779: 18e5d28 219775: 72fb585 v: v3
1 parent 9c8e104 commit b69090f

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,6 +1,6 @@
11
---
22
refs/heads/master: c044791d80ea0dc5c4b57b6030a67b69f8510239
3-
refs/heads/snap-stage3: 95c08e37872da325bb785ee4832f5cc4709c2860
3+
refs/heads/snap-stage3: 6b5edd24f54041b0bb1acafbcf3ccb77868be816
44
refs/heads/try: b53c0f93eedcdedd4fd89bccc5a3a09d1c5cd23e
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/snap-stage3/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)