Skip to content

Commit 5375cf8

Browse files
committed
auto merge of #9491 : thestinger/rust/noreturn, r=huonw
Closes #9317
2 parents 797a373 + e76bfae commit 5375cf8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/librustc/middle/trans/base.rs

+6
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,12 @@ pub fn decl_rust_fn(ccx: &mut CrateContext, inputs: &[ty::t], output: ty::t,
220220
let llfn = decl_cdecl_fn(ccx.llmod, name, llfty);
221221

222222
match ty::get(output).sty {
223+
// functions returning bottom may unwind, but can never return normally
224+
ty::ty_bot => {
225+
unsafe {
226+
llvm::LLVMAddFunctionAttr(llfn, lib::llvm::NoReturnAttribute as c_uint)
227+
}
228+
}
223229
// `~` pointer return values never alias because ownership is transferred
224230
ty::ty_uniq(*) |
225231
ty::ty_evec(_, ty::vstore_uniq) => {

0 commit comments

Comments
 (0)