mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-30 21:16:27 +03:00
Add intrinsics::unreachable
This commit is contained in:
@@ -250,6 +250,13 @@ fn visit_leave_fn(&mut self, purity: uint, proto: uint,
|
||||
/// Abort the execution of the process.
|
||||
pub fn abort() -> !;
|
||||
|
||||
/// Tell LLVM that this point in the code is not reachable,
|
||||
/// enabling further optimizations.
|
||||
///
|
||||
/// NB: This is very different from the `unreachable!()` macro!
|
||||
#[cfg(not(stage0))]
|
||||
pub fn unreachable() -> !;
|
||||
|
||||
/// Execute a breakpoint trap, for inspection by a debugger.
|
||||
pub fn breakpoint();
|
||||
|
||||
|
||||
@@ -228,6 +228,10 @@ pub fn trans_intrinsic_call<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>, node: ast::N
|
||||
Unreachable(bcx);
|
||||
v
|
||||
}
|
||||
(_, "unreachable") => {
|
||||
Unreachable(bcx);
|
||||
C_nil(ccx)
|
||||
}
|
||||
(_, "breakpoint") => {
|
||||
let llfn = ccx.get_intrinsic(&("llvm.debugtrap"));
|
||||
Call(bcx, llfn, [], None)
|
||||
|
||||
@@ -5589,6 +5589,7 @@ fn param(ccx: &CrateCtxt, n: uint) -> ty::t {
|
||||
} else {
|
||||
match name.get() {
|
||||
"abort" => (0, Vec::new(), ty::mk_bot()),
|
||||
"unreachable" => (0, Vec::new(), ty::mk_bot()),
|
||||
"breakpoint" => (0, Vec::new(), ty::mk_nil()),
|
||||
"size_of" |
|
||||
"pref_align_of" | "min_align_of" => (1u, Vec::new(), ty::mk_uint()),
|
||||
|
||||
Reference in New Issue
Block a user