From 4fd318b9e911dbaa63881b0a229f292bad1bdf9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Steinbrink?= Date: Mon, 21 Mar 2016 11:38:48 +0100 Subject: [PATCH] Fix tupling of fn args for rust-call ABI functions Fixes #32389 --- src/librustc_trans/trans/base.rs | 1 + src/test/run-pass/issue-32389.rs | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 src/test/run-pass/issue-32389.rs diff --git a/src/librustc_trans/trans/base.rs b/src/librustc_trans/trans/base.rs index 93ca306f0b0..1844c41760c 100644 --- a/src/librustc_trans/trans/base.rs +++ b/src/librustc_trans/trans/base.rs @@ -1685,6 +1685,7 @@ impl<'blk, 'tcx> FunctionContext<'blk, 'tcx> { 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 index 00000000000..2f6cfb61205 --- /dev/null +++ b/src/test/run-pass/issue-32389.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn foo() -> T { loop {} } + +fn test() { + let ref mut a: &mut FnMut((i8,), i16) = foo(); + a((0,), 0); +} + +fn main() { + let _ = test; +}