diff options
| author | Simon BD <simon@server> | 2012-10-03 21:47:09 -0500 |
|---|---|---|
| committer | Simon BD <simon@server> | 2012-10-03 21:47:09 -0500 |
| commit | efcd2385ea2389f270ff8ac8bc256636f647b130 (patch) | |
| tree | 7e142ef709bc907a34ab1cb252eef6dcc0e83b91 /src/libcore/rt.rs | |
| parent | 44f8a4401ab37a45ba49db56611d77807bcbce35 (diff) | |
| parent | 3ccf6f5932d8223fd6c5cbf7c6ac429ca9e8912a (diff) | |
Merge remote-tracking branch 'original/incoming' into incoming
Conflicts: src/libstd/json.rs src/libstd/sort.rs
Diffstat (limited to 'src/libcore/rt.rs')
| -rw-r--r-- | src/libcore/rt.rs | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/libcore/rt.rs b/src/libcore/rt.rs index 644edb69d56..9bc83a5f904 100644 --- a/src/libcore/rt.rs +++ b/src/libcore/rt.rs @@ -11,10 +11,9 @@ use libc::uintptr_t; use gc::{cleanup_stack_for_failure, gc, Word}; #[allow(non_camel_case_types)] -type rust_task = c_void; +pub type rust_task = c_void; extern mod rustrt { - #[legacy_exports]; #[rust_stack] fn rust_upcall_fail(expr: *c_char, file: *c_char, line: size_t); @@ -35,13 +34,23 @@ extern mod rustrt { // 'rt_', otherwise the compiler won't find it. To fix this, see // gather_rust_rtcalls. #[rt(fail_)] -fn rt_fail_(expr: *c_char, file: *c_char, line: size_t) { +pub fn rt_fail_(expr: *c_char, file: *c_char, line: size_t) { cleanup_stack_for_failure(); rustrt::rust_upcall_fail(expr, file, line); } +#[rt(fail_bounds_check)] +pub fn rt_fail_bounds_check(file: *c_char, line: size_t, + index: size_t, len: size_t) { + let msg = fmt!("index out of bounds: the len is %d but the index is %d", + len as int, index as int); + do str::as_buf(msg) |p, _len| { + rt_fail_(p as *c_char, file, line); + } +} + #[rt(exchange_malloc)] -fn rt_exchange_malloc(td: *c_char, size: uintptr_t) -> *c_char { +pub fn rt_exchange_malloc(td: *c_char, size: uintptr_t) -> *c_char { return rustrt::rust_upcall_exchange_malloc(td, size); } @@ -49,12 +58,12 @@ fn rt_exchange_malloc(td: *c_char, size: uintptr_t) -> *c_char { // inside a landing pad may corrupt the state of the exception handler. If a // problem occurs, call exit instead. #[rt(exchange_free)] -fn rt_exchange_free(ptr: *c_char) { +pub fn rt_exchange_free(ptr: *c_char) { rustrt::rust_upcall_exchange_free(ptr); } #[rt(malloc)] -fn rt_malloc(td: *c_char, size: uintptr_t) -> *c_char { +pub fn rt_malloc(td: *c_char, size: uintptr_t) -> *c_char { return rustrt::rust_upcall_malloc(td, size); } @@ -62,7 +71,7 @@ fn rt_malloc(td: *c_char, size: uintptr_t) -> *c_char { // inside a landing pad may corrupt the state of the exception handler. If a // problem occurs, call exit instead. #[rt(free)] -fn rt_free(ptr: *c_char) { +pub fn rt_free(ptr: *c_char) { rustrt::rust_upcall_free(ptr); } |
