]> git.lizzy.rs Git - rust.git/commitdiff
auto merge of #16484 : dotdash/rust/empty_struct_wrapper_arg, r=luqmana
authorbors <bors@rust-lang.org>
Thu, 14 Aug 2014 14:51:19 +0000 (14:51 +0000)
committerbors <bors@rust-lang.org>
Thu, 14 Aug 2014 14:51:19 +0000 (14:51 +0000)
Fixes #16441.

src/librustc/middle/trans/foreign.rs
src/test/run-pass/issue-16441.rs [new file with mode: 0644]

index 88bb88da3f043d31117461ef61ea42e89b283fb0..fe9b593c11c7e1dee174642f0bbf78db75c7dff9 100644 (file)
@@ -741,6 +741,12 @@ unsafe fn build_wrap_fn(ccx: &CrateContext,
             let llforeign_arg_ty = *tys.fn_ty.arg_tys.get(i);
             let foreign_indirect = llforeign_arg_ty.is_indirect();
 
+            if llforeign_arg_ty.is_ignore() {
+                debug!("skipping ignored arg #{}", i);
+                llrust_args.push(C_undef(llrust_ty));
+                continue;
+            }
+
             // skip padding
             let foreign_index = next_foreign_arg(llforeign_arg_ty.pad.is_some());
             let mut llforeign_arg = get_param(llwrapfn, foreign_index);
diff --git a/src/test/run-pass/issue-16441.rs b/src/test/run-pass/issue-16441.rs
new file mode 100644 (file)
index 0000000..62c36e1
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2014 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.
+
+struct Empty;
+
+// This used to cause an ICE
+extern "C" fn ice(_a: Empty) {}
+
+fn main() {
+}