Skip to content

Commit a1b305c

Browse files
committed
Remove or annotate FIXMEs in core::str
Trimmed exports in core::str::unsafe. Annotated other FIXMEs. Also moved the test for str::unsafe::from_buf_len inside str_unsafe since it's no longer exported. If it's not good to do that, let me know.
1 parent ea00637 commit a1b305c

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

src/libcore/str.rs

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ fn split_inner(s: str, sepfn: fn(cc: char) -> bool, count: uint,
445445
result
446446
}
447447

448-
// FIXME use Boyer-Moore
448+
// See Issue #1932 for why this is a naive search
449449
fn iter_matches(s: str, sep: str, f: fn(uint, uint)) {
450450
let sep_len = len(sep), l = len(s);
451451
assert sep_len > 0u;
@@ -581,7 +581,7 @@ pure fn le(&&a: str, &&b: str) -> bool { a <= b }
581581
#[doc = "String hash function"]
582582
fn hash(&&s: str) -> uint {
583583
// djb hash.
584-
// FIXME: replace with murmur.
584+
// FIXME: replace with murmur. (see #859 and #1616)
585585
let mut u: uint = 5381u;
586586
for each(s) {|c| u *= 33u; u += c as uint; }
587587
ret u;
@@ -1072,7 +1072,7 @@ or equal to `len(s)`.
10721072
"]
10731073
fn find_str_between(haystack: str, needle: str, start: uint, end:uint)
10741074
-> option<uint> {
1075-
// FIXME: Boyer-Moore should be significantly faster
1075+
// See Issue #1932 for why this is a naive search
10761076
assert end <= len(haystack);
10771077
let needle_len = len(needle);
10781078
if needle_len == 0u { ret some(start); }
@@ -1600,16 +1600,11 @@ fn capacity(&&s: str) -> uint unsafe {
16001600
#[doc = "Unsafe operations"]
16011601
mod unsafe {
16021602
export
1603-
// FIXME: stop exporting several of these
16041603
from_buf,
1605-
from_buf_len,
16061604
from_c_str,
1607-
from_c_str_len,
16081605
from_bytes,
1609-
from_byte,
16101606
slice_bytes,
16111607
push_byte,
1612-
push_bytes,
16131608
pop_byte,
16141609
shift_byte,
16151610
set_len;
@@ -1740,6 +1735,15 @@ mod unsafe {
17401735
let null = ptr::mut_offset(ptr::mut_addr_of((*repr).data), new_len);
17411736
*null = 0u8;
17421737
}
1738+
1739+
#[test]
1740+
fn test_from_buf_len() unsafe {
1741+
let a = [65u8, 65u8, 65u8, 65u8, 65u8, 65u8, 65u8, 0u8];
1742+
let b = vec::unsafe::to_ptr(a);
1743+
let c = from_buf_len(b, 3u);
1744+
assert (c == "AAA");
1745+
}
1746+
17431747
}
17441748

17451749
#[doc = "Extension methods for strings"]
@@ -2439,14 +2443,6 @@ mod tests {
24392443
assert (c == "AAAAAAA");
24402444
}
24412445

2442-
#[test]
2443-
fn test_from_buf_len() unsafe {
2444-
let a = [65u8, 65u8, 65u8, 65u8, 65u8, 65u8, 65u8, 0u8];
2445-
let b = vec::unsafe::to_ptr(a);
2446-
let c = unsafe::from_buf_len(b, 3u);
2447-
assert (c == "AAA");
2448-
}
2449-
24502446
#[test]
24512447
#[ignore(cfg(target_os = "win32"))]
24522448
#[should_fail]

0 commit comments

Comments
 (0)