Skip to content

Commit 56b86aa

Browse files
committed
auto merge of #16484 : dotdash/rust/empty_struct_wrapper_arg, r=luqmana
Fixes #16441.
2 parents e99eeb5 + 4df0430 commit 56b86aa

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/librustc/middle/trans/foreign.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,12 @@ pub fn trans_rust_fn_with_foreign_abi(ccx: &CrateContext,
741741
let llforeign_arg_ty = *tys.fn_ty.arg_tys.get(i);
742742
let foreign_indirect = llforeign_arg_ty.is_indirect();
743743

744+
if llforeign_arg_ty.is_ignore() {
745+
debug!("skipping ignored arg #{}", i);
746+
llrust_args.push(C_undef(llrust_ty));
747+
continue;
748+
}
749+
744750
// skip padding
745751
let foreign_index = next_foreign_arg(llforeign_arg_ty.pad.is_some());
746752
let mut llforeign_arg = get_param(llwrapfn, foreign_index);

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2014 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+
struct Empty;
12+
13+
// This used to cause an ICE
14+
extern "C" fn ice(_a: Empty) {}
15+
16+
fn main() {
17+
}

0 commit comments

Comments
 (0)