Skip to content

Commit e3ade0f

Browse files
committed
rollup merge of rust-lang#18644 : luqmana/pefc
2 parents b5ca21e + 20c1945 commit e3ade0f

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

src/librustc/middle/trans/build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ pub fn _UndefReturn(cx: Block, fn_: ValueRef) -> ValueRef {
655655
unsafe {
656656
let ccx = cx.fcx.ccx;
657657
let ty = val_ty(fn_);
658-
let retty = if ty.kind() == llvm::Integer {
658+
let retty = if ty.kind() == llvm::Function {
659659
ty.return_type()
660660
} else {
661661
ccx.int_type()

src/test/run-fail/issue-18576.rs

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
// error-pattern:stop
12+
13+
// #18576
14+
// Make sure that an calling extern function pointer in an unreachable
15+
// context doesn't cause an LLVM assertion
16+
17+
#[allow(unreachable_code)]
18+
fn main() {
19+
panic!("stop");
20+
let pointer = other;
21+
pointer();
22+
}
23+
extern fn other() {}

0 commit comments

Comments
 (0)