Skip to content

Commit

Permalink
Fix tupling of fn args for rust-call ABI functions
Browse files Browse the repository at this point in the history
Fixes #32389
  • Loading branch information
dotdash committed Mar 21, 2016
1 parent 6c4b1f1 commit 4fd318b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/librustc_trans/trans/base.rs
Expand Up @@ -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];
Expand Down
20 changes: 20 additions & 0 deletions 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 <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;
}

0 comments on commit 4fd318b

Please sign in to comment.