Skip to content

Commit

Permalink
add noreturn attribute to functions returning !
Browse files Browse the repository at this point in the history
Closes #9317
  • Loading branch information
thestinger committed Sep 25, 2013
1 parent 893ba18 commit e76bfae
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/librustc/middle/trans/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,12 @@ pub fn decl_rust_fn(ccx: &mut CrateContext, inputs: &[ty::t], output: ty::t,
let llfn = decl_cdecl_fn(ccx.llmod, name, llfty);

match ty::get(output).sty {
// functions returning bottom may unwind, but can never return normally
ty::ty_bot => {
unsafe {
llvm::LLVMAddFunctionAttr(llfn, lib::llvm::NoReturnAttribute as c_uint)
}
}
// `~` pointer return values never alias because ownership is transferred
ty::ty_uniq(*) |
ty::ty_evec(_, ty::vstore_uniq) => {
Expand Down

9 comments on commit e76bfae

@bors
Copy link
Contributor

@bors bors commented on e76bfae Sep 25, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on e76bfae Sep 25, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging thestinger/rust/noreturn = e76bfae into auto

@bors
Copy link
Contributor

@bors bors commented on e76bfae Sep 25, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thestinger/rust/noreturn = e76bfae merged ok, testing candidate = b62b80e7

@bors
Copy link
Contributor

@bors bors commented on e76bfae Sep 25, 2013

@bors
Copy link
Contributor

@bors bors commented on e76bfae Sep 25, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on e76bfae Sep 25, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging thestinger/rust/noreturn = e76bfae into auto

@bors
Copy link
Contributor

@bors bors commented on e76bfae Sep 25, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thestinger/rust/noreturn = e76bfae merged ok, testing candidate = 5375cf8

@bors
Copy link
Contributor

@bors bors commented on e76bfae Sep 25, 2013

@bors
Copy link
Contributor

@bors bors commented on e76bfae Sep 25, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 5375cf8

Please sign in to comment.