Skip to content

Commit 29ed4eb

Browse files
committed
---
yaml --- r: 63157 b: refs/heads/snap-stage3 c: c32fb53 h: refs/heads/master i: 63155: e956a3e v: v3
1 parent 44663d7 commit 29ed4eb

36 files changed

+186
-208
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: b29cd22bce6325a60788ab84f989bd2e82fcaaf4
4+
refs/heads/snap-stage3: c32fb53cf9ae20a657d17bd8e2f0b36863096583
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/doc/rust.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ An example of `use` declarations:
803803

804804
~~~~
805805
use std::float::sin;
806-
use std::str::{slice, contains};
806+
use std::str::{from_chars, contains};
807807
use std::option::Some;
808808
809809
fn main() {
@@ -814,8 +814,8 @@ fn main() {
814814
info!(Some(1.0));
815815
816816
// Equivalent to
817-
// 'info!(std::str::contains(std::str::slice("foo", 0, 1), "oo"));'
818-
info!(contains(slice("foo", 0, 1), "oo"));
817+
// 'info!(std::str::contains(std::str::from_chars(&['f','o','o']), "oo"));'
818+
info!(contains(from_chars(&['f','o','o']), "oo"));
819819
}
820820
~~~~
821821

branches/snap-stage3/src/compiletest/errors.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ fn parse_expected(line_num: uint, line: ~str) -> ~[ExpectedError] {
3333
let mut idx;
3434
match str::find_str(line, error_tag) {
3535
None => return ~[],
36-
Some(nn) => { idx = (nn as uint) + str::len(error_tag); }
36+
Some(nn) => { idx = (nn as uint) + error_tag.len(); }
3737
}
3838

3939
// "//~^^^ kind msg" denotes a message expected
4040
// three lines above current line:
4141
let mut adjust_line = 0u;
42-
let len = str::len(line);
42+
let len = line.len();
4343
while idx < len && line[idx] == ('^' as u8) {
4444
adjust_line += 1u;
4545
idx += 1u;
@@ -52,12 +52,12 @@ fn parse_expected(line_num: uint, line: ~str) -> ~[ExpectedError] {
5252

5353
// FIXME: #4318 Instead of to_ascii and to_str_ascii, could use
5454
// to_ascii_consume and to_str_consume to not do a unnecessary copy.
55-
let kind = str::slice(line, start_kind, idx);
55+
let kind = line.slice(start_kind, idx);
5656
let kind = kind.to_ascii().to_lower().to_str_ascii();
5757

5858
// Extract msg:
5959
while idx < len && line[idx] == (' ' as u8) { idx += 1u; }
60-
let msg = str::slice(line, idx, len).to_owned();
60+
let msg = line.slice(idx, len).to_owned();
6161

6262
debug!("line=%u kind=%s msg=%s", line_num - adjust_line, kind, msg);
6363

branches/snap-stage3/src/compiletest/header.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ fn parse_name_value_directive(line: &str,
177177
let keycolon = directive + ":";
178178
match str::find_str(line, keycolon) {
179179
Some(colon) => {
180-
let value = str::slice(line, colon + str::len(keycolon),
181-
str::len(line)).to_owned();
180+
let value = line.slice(colon + keycolon.len(),
181+
line.len()).to_owned();
182182
debug!("%s: %s", directive, value);
183183
Some(value)
184184
}

branches/snap-stage3/src/libextra/getopts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ pub fn getopts(args: &[~str], opts: &[Opt]) -> Result {
247247
let mut names;
248248
let mut i_arg = None;
249249
if cur[1] == '-' as u8 {
250-
let tail = str::slice(cur, 2, curlen);
250+
let tail = cur.slice(2, curlen);
251251
let tail_eq: ~[&str] = tail.split_iter('=').collect();
252252
if tail_eq.len() <= 1 {
253253
names = ~[Long(tail.to_owned())];

branches/snap-stage3/src/libextra/net_tcp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1809,7 +1809,7 @@ mod test {
18091809
}
18101810

18111811
fn buf_write<W:io::Writer>(w: &W, val: &str) {
1812-
debug!("BUF_WRITE: val len %?", str::len(val));
1812+
debug!("BUF_WRITE: val len %?", val.len());
18131813
do str::byte_slice(val) |b_slice| {
18141814
debug!("BUF_WRITE: b_slice len %?",
18151815
b_slice.len());

branches/snap-stage3/src/libextra/net_url.rs

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ pub fn decode_form_urlencoded(s: &[u8]) -> HashMap<~str, ~[~str]> {
291291

292292

293293
fn split_char_first(s: &str, c: char) -> (~str, ~str) {
294-
let len = str::len(s);
294+
let len = s.len();
295295
let mut index = len;
296296
let mut mat = 0;
297297
do io::with_str_reader(s) |rdr| {
@@ -307,16 +307,16 @@ fn split_char_first(s: &str, c: char) -> (~str, ~str) {
307307
}
308308
}
309309
if index+mat == len {
310-
return (str::slice(s, 0, index).to_owned(), ~"");
310+
return (s.slice(0, index).to_owned(), ~"");
311311
} else {
312-
return (str::slice(s, 0, index).to_owned(),
313-
str::slice(s, index + mat, str::len(s)).to_owned());
312+
return (s.slice(0, index).to_owned(),
313+
s.slice(index + mat, s.len()).to_owned());
314314
}
315315
}
316316

317317
fn userinfo_from_str(uinfo: &str) -> UserInfo {
318318
let (user, p) = split_char_first(uinfo, ':');
319-
let pass = if str::len(p) == 0 {
319+
let pass = if p.is_empty() {
320320
None
321321
} else {
322322
Some(p)
@@ -333,7 +333,7 @@ fn userinfo_to_str(userinfo: &UserInfo) -> ~str {
333333

334334
fn query_from_str(rawquery: &str) -> Query {
335335
let mut query: Query = ~[];
336-
if str::len(rawquery) != 0 {
336+
if !rawquery.is_empty() {
337337
for rawquery.split_iter('&').advance |p| {
338338
let (k, v) = split_char_first(p, '=');
339339
query.push((decode_component(k), decode_component(v)));
@@ -373,7 +373,7 @@ pub fn get_scheme(rawurl: &str) -> Result<(~str, ~str), ~str> {
373373
return Err(~"url: Scheme cannot be empty.");
374374
} else {
375375
return Ok((rawurl.slice(0,i).to_owned(),
376-
rawurl.slice(i+1,str::len(rawurl)).to_owned()));
376+
rawurl.slice(i+1,rawurl.len()).to_owned()));
377377
}
378378
}
379379
_ => {
@@ -475,7 +475,7 @@ fn get_authority(rawurl: &str) ->
475475
}
476476
Ip6Host => {
477477
if colon_count > 7 {
478-
host = str::slice(rawurl, begin, i).to_owned();
478+
host = rawurl.slice(begin, i).to_owned();
479479
pos = i;
480480
st = InPort;
481481
}
@@ -492,13 +492,13 @@ fn get_authority(rawurl: &str) ->
492492
colon_count = 0; // reset count
493493
match st {
494494
Start => {
495-
let user = str::slice(rawurl, begin, i).to_owned();
495+
let user = rawurl.slice(begin, i).to_owned();
496496
userinfo = Some(UserInfo::new(user, None));
497497
st = InHost;
498498
}
499499
PassHostPort => {
500-
let user = str::slice(rawurl, begin, pos).to_owned();
501-
let pass = str::slice(rawurl, pos+1, i).to_owned();
500+
let user = rawurl.slice(begin, pos).to_owned();
501+
let pass = rawurl.slice(pos+1, i).to_owned();
502502
userinfo = Some(UserInfo::new(user, Some(pass)));
503503
st = InHost;
504504
}
@@ -529,39 +529,39 @@ fn get_authority(rawurl: &str) ->
529529
match st {
530530
Start => {
531531
if host_is_end_plus_one() {
532-
host = str::slice(rawurl, begin, end+1).to_owned();
532+
host = rawurl.slice(begin, end+1).to_owned();
533533
} else {
534-
host = str::slice(rawurl, begin, end).to_owned();
534+
host = rawurl.slice(begin, end).to_owned();
535535
}
536536
}
537537
PassHostPort | Ip6Port => {
538538
if in != Digit {
539539
return Err(~"Non-digit characters in port.");
540540
}
541-
host = str::slice(rawurl, begin, pos).to_owned();
542-
port = Some(str::slice(rawurl, pos+1, end).to_owned());
541+
host = rawurl.slice(begin, pos).to_owned();
542+
port = Some(rawurl.slice(pos+1, end).to_owned());
543543
}
544544
Ip6Host | InHost => {
545-
host = str::slice(rawurl, begin, end).to_owned();
545+
host = rawurl.slice(begin, end).to_owned();
546546
}
547547
InPort => {
548548
if in != Digit {
549549
return Err(~"Non-digit characters in port.");
550550
}
551-
port = Some(str::slice(rawurl, pos+1, end).to_owned());
551+
port = Some(rawurl.slice(pos+1, end).to_owned());
552552
}
553553
}
554554

555555
let rest = if host_is_end_plus_one() { ~"" }
556-
else { str::slice(rawurl, end, len).to_owned() };
556+
else { rawurl.slice(end, len).to_owned() };
557557
return Ok((userinfo, host, port, rest));
558558
}
559559

560560

561561
// returns the path and unparsed part of url, or an error
562562
fn get_path(rawurl: &str, authority: bool) ->
563563
Result<(~str, ~str), ~str> {
564-
let len = str::len(rawurl);
564+
let len = rawurl.len();
565565
let mut end = len;
566566
for rawurl.iter().enumerate().advance |(i,c)| {
567567
match c {
@@ -585,25 +585,25 @@ fn get_path(rawurl: &str, authority: bool) ->
585585
}
586586
}
587587

588-
return Ok((decode_component(str::slice(rawurl, 0, end)),
589-
str::slice(rawurl, end, len).to_owned()));
588+
return Ok((decode_component(rawurl.slice(0, end)),
589+
rawurl.slice(end, len).to_owned()));
590590
}
591591

592592
// returns the parsed query and the fragment, if present
593593
fn get_query_fragment(rawurl: &str) ->
594594
Result<(Query, Option<~str>), ~str> {
595595
if !str::starts_with(rawurl, "?") {
596596
if str::starts_with(rawurl, "#") {
597-
let f = decode_component(str::slice(rawurl,
597+
let f = decode_component(rawurl.slice(
598598
1,
599-
str::len(rawurl)));
599+
rawurl.len()));
600600
return Ok((~[], Some(f)));
601601
} else {
602602
return Ok((~[], None));
603603
}
604604
}
605-
let (q, r) = split_char_first(str::slice(rawurl, 1, rawurl.len()), '#');
606-
let f = if str::len(r) != 0 {
605+
let (q, r) = split_char_first(rawurl.slice(1, rawurl.len()), '#');
606+
let f = if r.len() != 0 {
607607
Some(decode_component(r)) } else { None };
608608
return Ok((query_from_str(q), f));
609609
}

branches/snap-stage3/src/libextra/rope.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pub fn empty() -> Rope {
7171
* * the function runs in linear time.
7272
*/
7373
pub fn of_str(str: @~str) -> Rope {
74-
return of_substr(str, 0u, str::len(*str));
74+
return of_substr(str, 0u, str.len());
7575
}
7676

7777
/**
@@ -98,7 +98,7 @@ pub fn of_str(str: @~str) -> Rope {
9898
*/
9999
pub fn of_substr(str: @~str, byte_offset: uint, byte_len: uint) -> Rope {
100100
if byte_len == 0u { return node::Empty; }
101-
if byte_offset + byte_len > str::len(*str) { fail!(); }
101+
if byte_offset + byte_len > str.len() { fail!(); }
102102
return node::Content(node::of_substr(str, byte_offset, byte_len));
103103
}
104104

@@ -657,7 +657,7 @@ pub mod node {
657657
* the length of `str`.
658658
*/
659659
pub fn of_str(str: @~str) -> @Node {
660-
return of_substr(str, 0u, str::len(*str));
660+
return of_substr(str, 0u, str.len());
661661
}
662662

663663
/**
@@ -705,7 +705,7 @@ pub mod node {
705705
*/
706706
pub fn of_substr_unsafer(str: @~str, byte_start: uint, byte_len: uint,
707707
char_len: uint) -> @Node {
708-
assert!((byte_start + byte_len <= str::len(*str)));
708+
assert!((byte_start + byte_len <= str.len()));
709709
let candidate = @Leaf(Leaf {
710710
byte_offset: byte_start,
711711
byte_len: byte_len,
@@ -1292,9 +1292,7 @@ mod tests {
12921292
node::Leaf(x) => {
12931293
str::push_str(
12941294
str,
1295-
str::slice(
1296-
*x.content, x.byte_offset,
1297-
x.byte_offset + x.byte_len));
1295+
x.content.slice(x.byte_offset, x.byte_offset + x.byte_len));
12981296
}
12991297
node::Concat(ref x) => {
13001298
aux(str, x.left);
@@ -1340,7 +1338,7 @@ mod tests {
13401338
assert!(rope_to_string(r) == *sample);
13411339

13421340
let mut string_iter = 0u;
1343-
let string_len = str::len(*sample);
1341+
let string_len = sample.len();
13441342
let mut rope_iter = iterator::char::start(r);
13451343
let mut equal = true;
13461344
while equal {

branches/snap-stage3/src/libextra/sha1.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,6 @@ pub fn sha1() -> @Sha1 {
281281
mod tests {
282282
use sha1;
283283

284-
use core::str;
285284
use core::vec;
286285

287286
#[test]
@@ -396,7 +395,7 @@ mod tests {
396395

397396
// Test that it works when accepting the message in pieces
398397
for tests.each |t| {
399-
let len = str::len(t.input);
398+
let len = t.input.len();
400399
let mut left = len;
401400
while left > 0u {
402401
let take = (left + 1u) / 2u;

branches/snap-stage3/src/libextra/time.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ priv fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
279279
match strs[i] { // can't use let due to stage0 bugs
280280
(ref needle, value) => {
281281
if match_str(ss, pos, *needle) {
282-
return Some((value, pos + str::len(*needle)));
282+
return Some((value, pos + needle.len()));
283283
}
284284
}
285285
}
@@ -598,7 +598,7 @@ priv fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
598598
// It's odd, but to maintain compatibility with c's
599599
// strptime we ignore the timezone.
600600
let mut pos = pos;
601-
let len = str::len(s);
601+
let len = s.len();
602602
while pos < len {
603603
let range = str::char_range_at(s, pos);
604604
pos = range.next;
@@ -651,7 +651,7 @@ priv fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
651651
tm_nsec: 0_i32,
652652
};
653653
let mut pos = 0u;
654-
let len = str::len(s);
654+
let len = s.len();
655655
let mut result = Err(~"Invalid time");
656656

657657
while !rdr.eof() && pos < len {

branches/snap-stage3/src/libfuzzer/fuzzer.rc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ pub fn check_variants_T<T:Copy>(crate: @ast::crate,
376376

377377
pub fn last_part(filename: ~str) -> ~str {
378378
let ix = str::rfind_char(filename, '/').get();
379-
str::slice(filename, ix + 1u, str::len(filename) - 3u).to_owned()
379+
filename.slice(ix + 1u, filename.len() - 3u).to_owned()
380380
}
381381

382382
pub enum happiness {
@@ -434,7 +434,7 @@ pub fn check_running(exe_filename: &Path) -> happiness {
434434
"/Users/jruderman/scripts/timed_run_rust_program.py",
435435
[exe_filename.to_str()]);
436436
let comb = str::from_bytes(p.output) + "\n" + str::from_bytes(p.error);
437-
if str::len(comb) > 1u {
437+
if comb.len() > 1u {
438438
error!("comb comb comb: %?", comb);
439439
}
440440

@@ -712,4 +712,3 @@ pub mod core {
712712
pub use std::cmp;
713713
pub use std::sys;
714714
}
715-

branches/snap-stage3/src/librustc/back/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ pub fn mangle(sess: Session, ss: path) -> ~str {
686686
for ss.each |s| {
687687
match *s { path_name(s) | path_mod(s) => {
688688
let sani = sanitize(*sess.str_of(s));
689-
n += fmt!("%u%s", str::len(sani), sani);
689+
n += fmt!("%u%s", sani.len(), sani);
690690
} }
691691
}
692692
n += "E"; // End name-sequence.

branches/snap-stage3/src/librustc/metadata/filesearch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ fn get_rustpkg_lib_path_nearest() -> Result<Path, ~str> {
186186
// On Unix should be "lib", on windows "bin"
187187
pub fn libdir() -> ~str {
188188
let libdir = env!("CFG_LIBDIR");
189-
if str::is_empty(libdir) {
189+
if libdir.is_empty() {
190190
fail!("rustc compiled without CFG_LIBDIR environment variable");
191191
}
192192
libdir.to_owned()

0 commit comments

Comments
 (0)