]> git.lizzy.rs Git - rust.git/commitdiff
Fix tupling of fn args for rust-call ABI functions
authorBjörn Steinbrink <bsteinbr@gmail.com>
Mon, 21 Mar 2016 10:38:48 +0000 (11:38 +0100)
committerBjörn Steinbrink <bsteinbr@gmail.com>
Mon, 21 Mar 2016 11:22:29 +0000 (12:22 +0100)
Fixes #32389

src/librustc_trans/trans/base.rs
src/test/run-pass/issue-32389.rs [new file with mode: 0644]

index 93ca306f0b0a2a464bbf18846c6ca94607769e8b..1844c41760c5f5dbd3561dd7c943cbb479dcbfc2 100644 (file)
@@ -1685,6 +1685,7 @@ fn bind_args(&'blk self,
                     for (j, &tupled_arg_ty) in tupled_arg_tys.iter().enumerate() {
                         let dst = StructGEP(bcx, llval, j);
                         let arg = &self.fn_ty.args[idx];
+                        idx += 1;
                         let b = &bcx.build();
                         if common::type_is_fat_ptr(bcx.tcx(), tupled_arg_ty) {
                             let meta = &self.fn_ty.args[idx];
diff --git a/src/test/run-pass/issue-32389.rs b/src/test/run-pass/issue-32389.rs
new file mode 100644 (file)
index 0000000..2f6cfb6
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn foo<T>() -> T { loop {} }
+
+fn test() {
+    let ref mut a: &mut FnMut((i8,), i16) = foo();
+    a((0,), 0);
+}
+
+fn main() {
+    let _ = test;
+}