core: Resolve some FIXMEs

This commit is contained in:
Brian Anderson 2012-02-05 17:30:47 -08:00
parent 34aa956e68
commit c04b897cb2
4 changed files with 12 additions and 22 deletions

View file

@ -164,28 +164,26 @@ mod ct {
let noflags: [flag] = [];
if i >= lim { ret {flags: noflags, next: i}; }
// FIXME: This recursion generates illegal instructions if the return
// value isn't boxed. Only started happening after the ivec conversion
fn more_(f: flag, s: str, i: uint, lim: uint) ->
@{flags: [flag], next: uint} {
{flags: [flag], next: uint} {
let next = parse_flags(s, i + 1u, lim);
let rest = next.flags;
let j = next.next;
let curr: [flag] = [f];
ret @{flags: curr + rest, next: j};
ret {flags: curr + rest, next: j};
}
let more = bind more_(_, s, i, lim);
let f = s[i];
ret if f == '-' as u8 {
*more(flag_left_justify)
more(flag_left_justify)
} else if f == '0' as u8 {
*more(flag_left_zero_pad)
more(flag_left_zero_pad)
} else if f == ' ' as u8 {
*more(flag_space_for_sign)
more(flag_space_for_sign)
} else if f == '+' as u8 {
*more(flag_sign_always)
more(flag_sign_always)
} else if f == '#' as u8 {
*more(flag_alternate)
more(flag_alternate)
} else { {flags: noflags, next: i} };
}
fn parse_count(s: str, i: uint, lim: uint) -> {count: count, next: uint} {

View file

@ -665,8 +665,6 @@ Returns:
The original string with all occurances of `from` replaced with `to`
*/
fn replace(s: str, from: str, to: str) : is_not_empty(from) -> str unsafe {
// FIXME (694): Shouldn't have to check this
check (is_not_empty(from));
if byte_len(s) == 0u {
ret "";
} else if starts_with(s, from) {

View file

@ -73,12 +73,6 @@ fn refcount<T>(t: @T) -> uint {
ret rustrt::refcount::<T>(t);
}
// FIXME: There's a wrapper for this in the task module and this really
// just belongs there
fn unsupervise() -> () {
ret rustrt::unsupervise();
}
fn log_str<T>(t: T) -> str {
rustrt::shape_log_str(get_type_desc::<T>(), t)
}

View file

@ -72,6 +72,7 @@ native mod rustrt {
fn start_task(id: task, closure: *rust_closure);
fn rust_task_is_unwinding(rt: *rust_task) -> bool;
fn unsupervise();
}
/* Section: Types */
@ -287,10 +288,7 @@ fn join(task_port: joinable_task) -> task_result {
if _id == id {
ret res
} else {
// FIXME: uncomment this when extfmt is moved to core
// in a snapshot.
// fail #fmt["join received id %d, expected %d", _id, id]
fail;
fail #fmt["join received id %d, expected %d", _id, id]
}
}
}
@ -303,7 +301,9 @@ Detaches this task from its parent in the task tree
An unsupervised task will not propagate its failure up the task tree
*/
fn unsupervise() { ret sys::unsupervise(); }
fn unsupervise() {
rustrt::unsupervise();
}
/*
Function: currently_unwinding()