diff options
| author | Daniel Micay <danielmicay@gmail.com> | 2013-10-20 23:13:48 -0400 |
|---|---|---|
| committer | Daniel Micay <danielmicay@gmail.com> | 2013-10-28 15:34:50 -0400 |
| commit | 541e5f84d7ccbf02f8fdab6da0ff92f7ffbf0866 (patch) | |
| tree | 322f1b094fe96327906dc66349d069c3d31cf745 /src/libstd | |
| parent | d664ca26357fad84b4bc48f903f4795d491ccfd1 (diff) | |
| download | rust-541e5f84d7ccbf02f8fdab6da0ff92f7ffbf0866.tar.gz rust-541e5f84d7ccbf02f8fdab6da0ff92f7ffbf0866.zip | |
add support for the `cold` function attribute
This allows a function to marked as infrequently called, resulting in any branch calling it to be considered colder.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/rt/borrowck.rs | 1 | ||||
| -rw-r--r-- | src/libstd/unstable/lang.rs | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/src/libstd/rt/borrowck.rs b/src/libstd/rt/borrowck.rs index 9d13e79464a..7fcd674009d 100644 --- a/src/libstd/rt/borrowck.rs +++ b/src/libstd/rt/borrowck.rs @@ -57,6 +57,7 @@ pub fn clear_task_borrow_list() { let _ = try_take_task_borrow_list(); } +#[cold] unsafe fn fail_borrowed(box: *mut raw::Box<()>, file: *c_char, line: size_t) -> ! { debug_borrow("fail_borrowed: ", box, 0, 0, file, line); diff --git a/src/libstd/unstable/lang.rs b/src/libstd/unstable/lang.rs index 6dfb319d592..89126bf9c9c 100644 --- a/src/libstd/unstable/lang.rs +++ b/src/libstd/unstable/lang.rs @@ -16,11 +16,13 @@ use libc::{c_char, size_t, uintptr_t}; use rt::task; use rt::borrowck; +#[cold] #[lang="fail_"] pub fn fail_(expr: *c_char, file: *c_char, line: size_t) -> ! { task::begin_unwind(expr, file, line); } +#[cold] #[lang="fail_bounds_check"] pub fn fail_bounds_check(file: *c_char, line: size_t, index: size_t, len: size_t) -> ! { let msg = format!("index out of bounds: the len is {} but the index is {}", |
