Skip to content

Commit 9ea2db7

Browse files
killerswanmarijnh
authored andcommitted
---
yaml --- r: 11442 b: refs/heads/master c: 7782f5d h: refs/heads/master v: v3
1 parent d19765c commit 9ea2db7

35 files changed

+136
-146
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: 1b957c0942007e60ec9ea6773c964ea7bdc199af
2+
refs/heads/master: 7782f5d6926be7970ec474b74302f2298ceccd13
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/cargo/cargo.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,10 @@ fn print(s: str) {
174174
}
175175

176176
fn rest(s: str, start: uint) -> str {
177-
if (start >= str::len_bytes(s)) {
177+
if (start >= str::len(s)) {
178178
""
179179
} else {
180-
str::slice(s, start, str::len_bytes(s))
180+
str::slice(s, start, str::len(s))
181181
}
182182
}
183183

@@ -689,7 +689,7 @@ fn cmd_install(c: cargo) unsafe {
689689
alt str::index(uuid, '/') {
690690
option::some(idx) {
691691
let source = str::slice(uuid, 0u, idx);
692-
uuid = str::slice(uuid, idx + 1u, str::len_bytes(uuid));
692+
uuid = str::slice(uuid, idx + 1u, str::len(uuid));
693693
install_uuid_specific(c, wd, source, uuid);
694694
}
695695
option::none {
@@ -701,7 +701,7 @@ fn cmd_install(c: cargo) unsafe {
701701
alt str::index(name, '/') {
702702
option::some(idx) {
703703
let source = str::slice(name, 0u, idx);
704-
name = str::slice(name, idx + 1u, str::len_bytes(name));
704+
name = str::slice(name, idx + 1u, str::len(name));
705705
install_named_specific(c, wd, source, name);
706706
}
707707
option::none {

trunk/src/comp/back/link.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ fn build_link_meta(sess: session, c: ast::crate, output: str,
395395
metas: provided_metas,
396396
dep_hashes: [str]) -> str {
397397
fn len_and_str(s: str) -> str {
398-
ret #fmt["%u_%s", str::len_bytes(s), s];
398+
ret #fmt["%u_%s", str::len(s), s];
399399
}
400400

401401
fn len_and_str_lit(l: ast::lit) -> str {
@@ -520,7 +520,7 @@ fn mangle(ss: path) -> str {
520520

521521
for s in ss {
522522
alt s { path_name(s) | path_mod(s) {
523-
n += #fmt["%u%s", str::len_bytes(s), s];
523+
n += #fmt["%u%s", str::len(s), s];
524524
} }
525525
}
526526
n += "E"; // End name-sequence.
@@ -572,8 +572,7 @@ fn link_binary(sess: session,
572572
(config.os == session::os_linux ||
573573
config.os == session::os_freebsd) &&
574574
option::is_some(found) && option::get(found) == 0u {
575-
ret str::slice(filename, 3u,
576-
str::len_bytes(filename));
575+
ret str::slice(filename, 3u, str::len(filename));
577576
} else { ret filename; }
578577
};
579578
fn rmext(filename: str) -> str {

trunk/src/comp/driver/diagnostic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ fn highlight_lines(cm: codemap::codemap, sp: span,
210210
if elided {
211211
let last_line = display_lines[vec::len(display_lines) - 1u];
212212
let s = #fmt["%s:%u ", fm.name, last_line + 1u];
213-
let indent = str::len_bytes(s);
213+
let indent = str::len(s);
214214
let out = "";
215215
while indent > 0u { out += " "; indent -= 1u; }
216216
out += "...\n";
@@ -228,7 +228,7 @@ fn highlight_lines(cm: codemap::codemap, sp: span,
228228
while num > 0u { num /= 10u; digits += 1u; }
229229

230230
// indent past |name:## | and the 0-offset column location
231-
let left = str::len_bytes(fm.name) + digits + lo.col + 3u;
231+
let left = str::len(fm.name) + digits + lo.col + 3u;
232232
let s = "";
233233
while left > 0u { str::push_char(s, ' '); left -= 1u; }
234234

trunk/src/comp/driver/rustc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import rustc::driver::diagnostic;
1313
fn version(argv0: str) {
1414
let vers = "unknown version";
1515
let env_vers = #env["CFG_VERSION"];
16-
if str::len_bytes(env_vers) != 0u { vers = env_vers; }
16+
if str::len(env_vers) != 0u { vers = env_vers; }
1717
io::stdout().write_str(#fmt["%s %s\n", argv0, vers]);
1818
io::stdout().write_str(#fmt["host: %s\n", host_triple()]);
1919
}

trunk/src/comp/middle/trans/common.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,7 @@ fn C_u8(i: uint) -> ValueRef { ret C_integral(T_i8(), i as u64, False); }
777777
// our boxed-and-length-annotated strings.
778778
fn C_cstr(cx: crate_ctxt, s: str) -> ValueRef {
779779
let sc = str::as_buf(s) {|buf|
780-
llvm::LLVMConstString(buf, str::len_bytes(s) as unsigned, False)
780+
llvm::LLVMConstString(buf, str::len(s) as unsigned, False)
781781
};
782782
let g =
783783
str::as_buf(cx.names("str"),
@@ -791,7 +791,7 @@ fn C_cstr(cx: crate_ctxt, s: str) -> ValueRef {
791791
// Returns a Plain Old LLVM String:
792792
fn C_postr(s: str) -> ValueRef {
793793
ret str::as_buf(s) {|buf|
794-
llvm::LLVMConstString(buf, str::len_bytes(s) as unsigned, False)
794+
llvm::LLVMConstString(buf, str::len(s) as unsigned, False)
795795
};
796796
}
797797

trunk/src/comp/middle/trans/debuginfo.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const DW_ATE_unsigned_char: int = 0x08;
4848

4949
fn llstr(s: str) -> ValueRef {
5050
str::as_buf(s, {|sbuf|
51-
llvm::LLVMMDString(sbuf, str::len_bytes(s) as ctypes::c_uint)
51+
llvm::LLVMMDString(sbuf, str::len(s) as ctypes::c_uint)
5252
})
5353
}
5454
fn lltag(lltag: int) -> ValueRef {
@@ -167,8 +167,7 @@ fn create_compile_unit(cx: crate_ctxt, full_path: str)
167167

168168
let work_dir = cx.sess.working_dir;
169169
let file_path = if str::starts_with(full_path, work_dir) {
170-
str::slice(full_path, str::len_bytes(work_dir),
171-
str::len_bytes(full_path))
170+
str::slice(full_path, str::len(work_dir), str::len(full_path))
172171
} else {
173172
full_path
174173
};

trunk/src/comp/middle/trans/tvec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ fn trans_vec(bcx: block, args: [@ast::expr], id: ast::node_id,
126126
}
127127

128128
fn trans_str(bcx: block, s: str, dest: dest) -> block {
129-
let veclen = str::len_bytes(s) + 1u; // +1 for \0
129+
let veclen = str::len(s) + 1u; // +1 for \0
130130
let {bcx: bcx, val: sptr, _} =
131131
alloc(bcx, ty::mk_str(bcx.tcx()), veclen);
132132

trunk/src/comp/syntax/codemap.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,9 @@ fn span_to_lines(sp: span, cm: codemap::codemap) -> @file_lines {
157157

158158
fn get_line(fm: filemap, line: int) -> str unsafe {
159159
let begin: uint = fm.lines[line].byte - fm.start_pos.byte;
160-
let end = alt str::index_from(*fm.src, '\n', begin,
161-
str::len_bytes(*fm.src)) {
160+
let end = alt str::index_from(*fm.src, '\n', begin, str::len(*fm.src)) {
162161
some(e) { e }
163-
none { str::len_bytes(*fm.src) }
162+
none { str::len(*fm.src) }
164163
};
165164
str::slice(*fm.src, begin, end)
166165
}

trunk/src/comp/syntax/parse/lexer.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ fn new_reader(cm: codemap::codemap,
6464
itr: @interner::interner<str>) -> reader {
6565
let r = @{cm: cm,
6666
span_diagnostic: span_diagnostic,
67-
src: filemap.src, len: str::len_bytes(*filemap.src),
67+
src: filemap.src, len: str::len(*filemap.src),
6868
mutable col: 0u, mutable pos: 0u, mutable curr: -1 as char,
6969
mutable chpos: filemap.start_pos.ch, mutable strs: [],
7070
filemap: filemap, interner: itr};
@@ -163,7 +163,7 @@ fn scan_exponent(rdr: reader) -> option<str> {
163163
rdr.bump();
164164
}
165165
let exponent = scan_digits(rdr, 10u);
166-
if str::len_bytes(exponent) > 0u {
166+
if str::len(exponent) > 0u {
167167
ret some(rslt + exponent);
168168
} else { rdr.fatal("scan_exponent: bad fp literal"); }
169169
} else { ret none::<str>; }
@@ -226,7 +226,7 @@ fn scan_number(c: char, rdr: reader) -> token::token {
226226
tp = if signed { either::left(ast::ty_i64) }
227227
else { either::right(ast::ty_u64) };
228228
}
229-
if str::len_bytes(num_str) == 0u {
229+
if str::len(num_str) == 0u {
230230
rdr.fatal("no valid digits found for number");
231231
}
232232
let parsed = option::get(u64::from_str(num_str, base as u64));
@@ -273,7 +273,7 @@ fn scan_number(c: char, rdr: reader) -> token::token {
273273
ret token::LIT_FLOAT(interner::intern(*rdr.interner, num_str),
274274
ast::ty_f);
275275
} else {
276-
if str::len_bytes(num_str) == 0u {
276+
if str::len(num_str) == 0u {
277277
rdr.fatal("no valid digits found for number");
278278
}
279279
let parsed = option::get(u64::from_str(num_str, base as u64));
@@ -610,8 +610,8 @@ fn trim_whitespace_prefix_and_push_line(&lines: [str],
610610
s: str, col: uint) unsafe {
611611
let s1;
612612
if all_whitespace(s, 0u, col) {
613-
if col < str::len_bytes(s) {
614-
s1 = str::slice(s, col, str::len_bytes(s));
613+
if col < str::len(s) {
614+
s1 = str::slice(s, col, str::len(s));
615615
} else { s1 = ""; }
616616
} else { s1 = s; }
617617
log(debug, "pushing line: " + s1);
@@ -651,7 +651,7 @@ fn read_block_comment(rdr: reader, code_to_the_left: bool) -> cmnt {
651651
}
652652
}
653653
}
654-
if str::len_bytes(curr_line) != 0u {
654+
if str::len(curr_line) != 0u {
655655
trim_whitespace_prefix_and_push_line(lines, curr_line, col);
656656
}
657657
let style = if code_to_the_left { trailing } else { isolated };

trunk/src/comp/syntax/print/pp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ fn end(p: printer) { p.pretty_print(END); }
491491
fn eof(p: printer) { p.pretty_print(EOF); }
492492

493493
fn word(p: printer, wrd: str) {
494-
p.pretty_print(STRING(wrd, str::len_bytes(wrd) as int));
494+
p.pretty_print(STRING(wrd, str::len(wrd) as int));
495495
}
496496

497497
fn huge_word(p: printer, wrd: str) {

trunk/src/comp/syntax/print/pprust.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ fn head(s: ps, w: str) {
204204
// outer-box is consistent
205205
cbox(s, indent_unit);
206206
// head-box is inconsistent
207-
ibox(s, str::len_bytes(w) + 1u);
207+
ibox(s, str::len(w) + 1u);
208208
// keyword that starts the head
209209
word_nbsp(s, w);
210210
}
@@ -1465,7 +1465,7 @@ fn print_ty_fn(s: ps, opt_proto: option<ast::proto>,
14651465
popen(s);
14661466
fn print_arg(s: ps, input: ast::arg) {
14671467
print_arg_mode(s, input.mode);
1468-
if str::len_bytes(input.ident) > 0u {
1468+
if str::len(input.ident) > 0u {
14691469
word_space(s, input.ident + ":");
14701470
}
14711471
print_type(s, input.ty);
@@ -1647,7 +1647,7 @@ fn print_string(s: ps, st: str) {
16471647

16481648
fn escape_str(st: str, to_escape: char) -> str {
16491649
let out: str = "";
1650-
let len = str::len_bytes(st);
1650+
let len = str::len(st);
16511651
let i = 0u;
16521652
while i < len {
16531653
alt st[i] as char {

trunk/src/comp/util/ppaux.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ fn ty_to_str(cx: ctxt, typ: t) -> str {
129129
}
130130
}
131131

132-
fn ty_to_short_str(cx: ctxt, typ: t) -> str unsafe {
132+
fn ty_to_short_str(cx: ctxt, typ: t) -> str {
133133
let s = encoder::encoded_ty(cx, typ);
134-
if str::len_bytes(s) >= 32u { s = str::slice(s, 0u, 32u); }
134+
if str::len(s) >= 32u { s = str::slice(s, 0u, 32u); }
135135
ret s;
136136
}
137137

trunk/src/compiletest/errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ fn parse_expected(line_num: uint, line: str) -> [expected_error] unsafe {
2727
let idx;
2828
alt str::find(line, error_tag) {
2929
option::none { ret []; }
30-
option::some(nn) { idx = (nn as uint) + str::len_bytes(error_tag); }
30+
option::some(nn) { idx = (nn as uint) + str::len(error_tag); }
3131
}
3232

3333
// "//!^^^ kind msg" denotes a message expected
3434
// three lines above current line:
3535
let adjust_line = 0u;
36-
let len = str::len_bytes(line);
36+
let len = str::len(line);
3737
while idx < len && line[idx] == ('^' as u8) {
3838
adjust_line += 1u;
3939
idx += 1u;

trunk/src/compiletest/header.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,8 @@ fn parse_name_value_directive(line: str,
108108
let keycolon = directive + ":";
109109
alt str::find(line, keycolon) {
110110
option::some(colon) {
111-
let value =
112-
str::slice(line,
113-
colon + str::len_bytes(keycolon),
114-
str::len_bytes(line));
111+
let value = str::slice(line, colon + str::len(keycolon),
112+
str::len(line));
115113
#debug("%s: %s", directive, value);
116114
option::some(value)
117115
}

trunk/src/fuzzer/fuzzer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ fn check_variants_T<T: copy>(
287287

288288
fn last_part(filename: str) -> str {
289289
let ix = option::get(str::rindex(filename, '/'));
290-
str::slice(filename, ix + 1u, str::len_bytes(filename) - 3u)
290+
str::slice(filename, ix + 1u, str::len(filename) - 3u)
291291
}
292292

293293
enum happiness { passed, cleanly_rejected(str), known_bug(str), failed(str), }
@@ -335,7 +335,7 @@ fn removeDirIfExists(filename: str) {
335335
fn check_running(exe_filename: str) -> happiness {
336336
let p = std::run::program_output("/Users/jruderman/scripts/timed_run_rust_program.py", [exe_filename]);
337337
let comb = p.out + "\n" + p.err;
338-
if str::len_bytes(comb) > 1u {
338+
if str::len(comb) > 1u {
339339
log(error, "comb comb comb: " + comb);
340340
}
341341

trunk/src/libcore/extfmt.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ mod ct {
8282

8383
fn parse_fmt_string(s: str, error: error_fn) -> [piece] unsafe {
8484
let pieces: [piece] = [];
85-
let lim = str::len_bytes(s);
85+
let lim = str::len(s);
8686
let buf = "";
8787
fn flush_buf(buf: str, &pieces: [piece]) -> str {
88-
if str::len_bytes(buf) > 0u {
88+
if str::len(buf) > 0u {
8989
let piece = piece_string(buf);
9090
pieces += [piece];
9191
}
@@ -433,12 +433,12 @@ mod rt {
433433
// zeros. It may make sense to convert zero padding to a precision
434434
// instead.
435435

436-
if signed && zero_padding && str::len_bytes(s) > 0u {
436+
if signed && zero_padding && str::len(s) > 0u {
437437
let head = s[0];
438438
if head == '+' as u8 || head == '-' as u8 || head == ' ' as u8 {
439439
let headstr = str::from_bytes([head]);
440440
// FIXME: not UTF-8 safe
441-
let bytelen = str::len_bytes(s);
441+
let bytelen = str::len(s);
442442
let numpart = str::slice(s, 1u, bytelen);
443443
ret headstr + padstr + numpart;
444444
}

trunk/src/libcore/float.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ number represented by [num].
133133
fn from_str(num: str) -> option<float> {
134134
let pos = 0u; //Current byte position in the string.
135135
//Used to walk the string in O(n).
136-
let len = str::len_bytes(num); //Length of the string, in bytes.
136+
let len = str::len(num); //Length of the string, in bytes.
137137

138138
if len == 0u { ret none; }
139139
let total = 0f; //Accumulated result

0 commit comments

Comments
 (0)