Skip to content

Commit 939cd94

Browse files
committed
Fix ICE trying to pass DST to C functions
Fixes #25581
1 parent cec980a commit 939cd94

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/librustc_trans/trans/callee.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ pub fn trans_call_inner<'a, 'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
846846

847847
let mut llargs = Vec::new();
848848
let arg_tys = match args {
849-
ArgExprs(a) => a.iter().map(|x| common::expr_ty(bcx, &**x)).collect(),
849+
ArgExprs(a) => a.iter().map(|x| common::expr_ty_adjusted(bcx, &**x)).collect(),
850850
_ => panic!("expected arg exprs.")
851851
};
852852
bcx = trans_args(bcx,

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

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2015 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+
extern {
12+
fn f(t: &[i32]);
13+
}
14+
15+
fn main() {
16+
unsafe {
17+
f(&[0i32]);
18+
}
19+
}

0 commit comments

Comments
 (0)