Skip to content

Commit b9752b6

Browse files
author
Jakub Wieczorek
committed
Fix an ICE when a function argument is of the bottom type
Fixes #13352
1 parent 6d3e89e commit b9752b6

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/librustc/middle/trans/callee.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ pub fn trans_arg_datum<'a>(
802802
// "undef" value, as such a value should never
803803
// be inspected. It's important for the value
804804
// to have type lldestty (the callee's expected type).
805-
let llformal_arg_ty = type_of::type_of(ccx, formal_arg_ty);
805+
let llformal_arg_ty = type_of::type_of_explicit_arg(ccx, formal_arg_ty);
806806
unsafe {
807807
val = llvm::LLVMGetUndef(llformal_arg_ty.to_ref());
808808
}

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
extern crate libc;
12+
13+
fn foo(_: proc()) {}
14+
15+
fn main() {
16+
foo(loop {
17+
unsafe { libc::exit(0 as libc::c_int); }
18+
});
19+
2u + (loop {});
20+
-(loop {});
21+
}

0 commit comments

Comments
 (0)