Skip to content

Commit 0168dc7

Browse files
committed
Auto merge of #32393 - dotdash:32389, r=eddyb
Fix tupling of fn args for rust-call ABI functions Fixes #32389
2 parents 0215681 + 4fd318b commit 0168dc7

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/librustc_trans/trans/base.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1685,6 +1685,7 @@ impl<'blk, 'tcx> FunctionContext<'blk, 'tcx> {
16851685
for (j, &tupled_arg_ty) in tupled_arg_tys.iter().enumerate() {
16861686
let dst = StructGEP(bcx, llval, j);
16871687
let arg = &self.fn_ty.args[idx];
1688+
idx += 1;
16881689
let b = &bcx.build();
16891690
if common::type_is_fat_ptr(bcx.tcx(), tupled_arg_ty) {
16901691
let meta = &self.fn_ty.args[idx];

src/test/run-pass/issue-32389.rs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn foo<T>() -> T { loop {} }
12+
13+
fn test() {
14+
let ref mut a: &mut FnMut((i8,), i16) = foo();
15+
a((0,), 0);
16+
}
17+
18+
fn main() {
19+
let _ = test;
20+
}

0 commit comments

Comments
 (0)