Skip to content

Commit 93d3f06

Browse files
committed
---
yaml --- r: 11210 b: refs/heads/master c: a131b43 h: refs/heads/master v: v3
1 parent a86f5ff commit 93d3f06

File tree

9 files changed

+23
-50
lines changed

9 files changed

+23
-50
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 5c58dde2f84edac1c24d48c050e23278206ac7c1
2+
refs/heads/master: a131b430a0e2e227c8771212dc5f469cd08e5dce
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/cargo/cargo.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ fn cmd_install(c: cargo) unsafe {
651651

652652
if str::starts_with(target, "uuid:") {
653653
let uuid = rest(target, 5u);
654-
let idx = str::index(uuid, '/' as u8);
654+
let idx = str::index_byte(uuid, '/' as u8);
655655
if idx != -1 {
656656
let source = str::unsafe::slice_bytes(uuid, 0u, idx as uint);
657657
uuid = str::unsafe::slice_bytes(uuid, idx as uint + 1u,
@@ -662,7 +662,7 @@ fn cmd_install(c: cargo) unsafe {
662662
}
663663
} else {
664664
let name = target;
665-
let idx = str::index(name, '/' as u8);
665+
let idx = str::index_byte(name, '/' as u8);
666666
if idx != -1 {
667667
let source = str::unsafe::slice_bytes(name, 0u, idx as uint);
668668
name = str::unsafe::slice_bytes(name, idx as uint + 1u,

trunk/src/comp/back/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ mod write {
109109
// Decides what to call an intermediate file, given the name of the output
110110
// and the extension to use.
111111
fn mk_intermediate_name(output_path: str, extension: str) -> str unsafe {
112-
let dot_pos = str::index(output_path, '.' as u8);
112+
let dot_pos = str::index_byte(output_path, '.' as u8);
113113
let stem;
114114
if dot_pos < 0 {
115115
stem = output_path;

trunk/src/comp/syntax/codemap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ fn get_line(fm: filemap, line: int) -> str unsafe {
125125
// the remainder of the file, which is undesirable.
126126
end = str::byte_len(*fm.src);
127127
let rest = str::unsafe::slice_bytes(*fm.src, begin, end);
128-
let newline = str::index(rest, '\n' as u8);
128+
let newline = str::index_byte(rest, '\n' as u8);
129129
if newline != -1 { end = begin + (newline as uint); }
130130
}
131131
ret str::unsafe::slice_bytes(*fm.src, begin, end);

trunk/src/fuzzer/fuzzer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ fn check_variants_T<T: copy>(
284284
}
285285

286286
fn last_part(filename: str) -> str unsafe {
287-
let ix = str::rindex(filename, 47u8 /* '/' */);
287+
let ix = str::rindex_byte(filename, 47u8 /* '/' */);
288288
assert ix >= 0;
289289
str::unsafe::slice_bytes(filename, ix as uint + 1u, str::byte_len(filename) - 3u)
290290
}

trunk/src/libcore/char.rs

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export is_alphabetic,
3737
is_XID_start, is_XID_continue,
3838
is_lowercase, is_uppercase,
3939
is_whitespace, is_alphanumeric,
40-
is_ascii,
4140
to_digit, to_lower, to_upper, maybe_digit, cmp;
4241

4342
import is_alphabetic = unicode::derived_property::Alphabetic;
@@ -85,17 +84,6 @@ pure fn is_alphanumeric(c: char) -> bool {
8584
unicode::general_category::No(c);
8685
}
8786

88-
#[doc( brief = "Indicates whether the character is an ASCII character" )]
89-
pure fn is_ascii(c: char) -> bool {
90-
c - ('\x7F' & c) == '\x00'
91-
}
92-
93-
#[doc( brief = "Indicates whether the character is numeric (Nd, Nl, or No)" )]
94-
pure fn is_digit(c: char) -> bool {
95-
ret unicode::general_category::Nd(c) ||
96-
unicode::general_category::Nl(c) ||
97-
unicode::general_category::No(c);
98-
}
9987

10088
#[doc(
10189
brief = "Convert a char to the corresponding digit. \
@@ -233,20 +221,3 @@ fn test_to_upper() {
233221
//assert (to_upper('ü') == 'Ü');
234222
assert (to_upper('ß') == 'ß');
235223
}
236-
237-
#[test]
238-
fn test_is_ascii() unsafe {
239-
assert str::all("banana", char::is_ascii);
240-
assert ! str::all("ประเทศไทย中华Việt Nam", char::is_ascii);
241-
}
242-
243-
#[test]
244-
fn test_is_digit() {
245-
assert is_digit('2');
246-
assert is_digit('7');
247-
assert ! is_digit('c');
248-
assert ! is_digit('i');
249-
assert ! is_digit('z');
250-
assert ! is_digit('Q');
251-
}
252-

trunk/src/libcore/str.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,10 @@ export
7070
lines_iter,
7171

7272
// Searching
73-
index,
74-
rindex,
73+
//index,
74+
//rindex,
75+
index_byte,
76+
rindex_byte,
7577
find,
7678
contains,
7779
starts_with,
@@ -876,7 +878,7 @@ no match is found.
876878
877879
FIXME: UTF-8
878880
*/
879-
fn index(s: str, c: u8) -> int {
881+
fn index_byte(s: str, c: u8) -> int {
880882
let i: int = 0;
881883
for k: u8 in s { if k == c { ret i; } i += 1; }
882884
ret -1;
@@ -890,7 +892,7 @@ if no match is found.
890892
891893
FIXME: UTF-8
892894
*/
893-
fn rindex(s: str, c: u8) -> int {
895+
fn rindex_byte(s: str, c: u8) -> int {
894896
let n: int = byte_len(s) as int;
895897
while n >= 0 { if s[n] == c { ret n; } n -= 1; }
896898
ret n;
@@ -1443,12 +1445,12 @@ mod tests {
14431445

14441446
#[test]
14451447
fn test_index_and_rindex() {
1446-
assert (index("hello", 'e' as u8) == 1);
1447-
assert (index("hello", 'o' as u8) == 4);
1448-
assert (index("hello", 'z' as u8) == -1);
1449-
assert (rindex("hello", 'l' as u8) == 3);
1450-
assert (rindex("hello", 'h' as u8) == 0);
1451-
assert (rindex("hello", 'z' as u8) == -1);
1448+
assert (index_byte("hello", 'e' as u8) == 1);
1449+
assert (index_byte("hello", 'o' as u8) == 4);
1450+
assert (index_byte("hello", 'z' as u8) == -1);
1451+
assert (rindex_byte("hello", 'l' as u8) == 3);
1452+
assert (rindex_byte("hello", 'h' as u8) == 0);
1453+
assert (rindex_byte("hello", 'z' as u8) == -1);
14521454
}
14531455

14541456
#[test]

trunk/src/libstd/fs.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ The dirname of "/usr/share" will be "/usr", but the dirname of
4444
If the path is not prefixed with a directory, then "." is returned.
4545
*/
4646
fn dirname(p: path) -> path unsafe {
47-
let i: int = str::rindex(p, os_fs::path_sep as u8);
47+
let i: int = str::rindex_byte(p, os_fs::path_sep as u8);
4848
if i == -1 {
49-
i = str::rindex(p, os_fs::alt_path_sep as u8);
49+
i = str::rindex_byte(p, os_fs::alt_path_sep as u8);
5050
if i == -1 { ret "."; }
5151
}
5252
ret str::unsafe::slice_bytes(p, 0u, i as uint);
@@ -64,9 +64,9 @@ the provided path. If an empty path is provided or the path ends
6464
with a path separator then an empty path is returned.
6565
*/
6666
fn basename(p: path) -> path unsafe {
67-
let i: int = str::rindex(p, os_fs::path_sep as u8);
67+
let i: int = str::rindex_byte(p, os_fs::path_sep as u8);
6868
if i == -1 {
69-
i = str::rindex(p, os_fs::alt_path_sep as u8);
69+
i = str::rindex_byte(p, os_fs::alt_path_sep as u8);
7070
if i == -1 { ret p; }
7171
}
7272
let len = str::byte_len(p);

trunk/src/libstd/getopts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ fn getopts(args: [str], opts: [opt]) -> result unsafe {
230230
let i_arg = option::none::<str>;
231231
if cur[1] == '-' as u8 {
232232
let tail = str::unsafe::slice_bytes(cur, 2u, curlen);
233-
let eq = str::index(tail, '=' as u8);
233+
let eq = str::index_byte(tail, '=' as u8);
234234
if eq == -1 {
235235
names = [long(tail)];
236236
} else {

0 commit comments

Comments
 (0)