Skip to content

Commit b61a3d2

Browse files
committed
---
yaml --- r: 50267 b: refs/heads/auto c: f41a510 h: refs/heads/master i: 50265: 14c0522 50263: f12246c v: v3
1 parent 3d4db46 commit b61a3d2

File tree

4 files changed

+47
-21
lines changed

4 files changed

+47
-21
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: 0a4d0f37ca97bb0b69f5f9e768269dde4acedae8
17+
refs/heads/auto: f41a510631ca8e41f16c8a0097a179d067ce4f7d
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167

branches/auto/src/libcore/str.rs

Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -435,12 +435,14 @@ pub fn slice<'a>(s: &'a str, begin: uint, end: uint) -> &'a str {
435435
}
436436

437437
/// Splits a string into substrings at each occurrence of a given character
438-
pub fn each_split_char(s: &'a str, sep: char, it: &fn(&'a str) -> bool) {
438+
pub fn each_split_char<'a>(s: &'a str, sep: char, it: &fn(&'a str) -> bool) {
439439
each_split_char_inner(s, sep, len(s), true, true, it)
440440
}
441441

442442
/// Like `each_split_char`, but a trailing empty string is omitted
443-
pub fn each_split_char_no_trailing(s: &'a str, sep: char, it: &fn(&'a str) -> bool) {
443+
pub fn each_split_char_no_trailing<'a>(s: &'a str,
444+
sep: char,
445+
it: &fn(&'a str) -> bool) {
444446
each_split_char_inner(s, sep, len(s), true, false, it)
445447
}
446448

@@ -450,17 +452,26 @@ pub fn each_split_char_no_trailing(s: &'a str, sep: char, it: &fn(&'a str) -> bo
450452
*
451453
* The character must be a valid UTF-8/ASCII character
452454
*/
453-
pub fn each_splitn_char(s: &'a str, sep: char, count: uint, it: &fn(&'a str) -> bool) {
455+
pub fn each_splitn_char<'a>(s: &'a str,
456+
sep: char,
457+
count: uint,
458+
it: &fn(&'a str) -> bool) {
454459
each_split_char_inner(s, sep, count, true, true, it)
455460
}
456461

457462
/// Like `each_split_char`, but omits empty strings
458-
pub fn each_split_char_nonempty(s: &'a str, sep: char, it: &fn(&'a str) -> bool) {
463+
pub fn each_split_char_nonempty<'a>(s: &'a str,
464+
sep: char,
465+
it: &fn(&'a str) -> bool) {
459466
each_split_char_inner(s, sep, len(s), false, false, it)
460467
}
461468

462-
fn each_split_char_inner(s: &'a str, sep: char, count: uint, allow_empty: bool,
463-
allow_trailing_empty: bool, it: &fn(&'a str) -> bool) {
469+
fn each_split_char_inner<'a>(s: &'a str,
470+
sep: char,
471+
count: uint,
472+
allow_empty: bool,
473+
allow_trailing_empty: bool,
474+
it: &fn(&'a str) -> bool) {
464475
if sep < 128u as char {
465476
let b = sep as u8, l = len(s);
466477
let mut done = 0u;
@@ -485,30 +496,43 @@ fn each_split_char_inner(s: &'a str, sep: char, count: uint, allow_empty: bool,
485496
}
486497

487498
/// Splits a string into substrings using a character function
488-
pub fn each_split(s: &'a str, sepfn: &fn(char) -> bool, it: &fn(&'a str) -> bool) {
499+
pub fn each_split<'a>(s: &'a str,
500+
sepfn: &fn(char) -> bool,
501+
it: &fn(&'a str) -> bool) {
489502
each_split_inner(s, sepfn, len(s), true, true, it)
490503
}
491504

492505
/// Like `each_split`, but a trailing empty string is omitted
493-
pub fn each_split_no_trailing(s: &'a str, sepfn: &fn(char) -> bool, it: &fn(&'a str) -> bool) {
506+
pub fn each_split_no_trailing<'a>(s: &'a str,
507+
sepfn: &fn(char) -> bool,
508+
it: &fn(&'a str) -> bool) {
494509
each_split_inner(s, sepfn, len(s), true, false, it)
495510
}
496511

497512
/**
498513
* Splits a string into substrings using a character function, cutting at
499514
* most `count` times.
500515
*/
501-
pub fn each_splitn(s: &'a str, sepfn: &fn(char) -> bool, count: uint, it: &fn(&'a str) -> bool) {
516+
pub fn each_splitn<'a>(s: &'a str,
517+
sepfn: &fn(char) -> bool,
518+
count: uint,
519+
it: &fn(&'a str) -> bool) {
502520
each_split_inner(s, sepfn, count, true, true, it)
503521
}
504522

505523
/// Like `each_split`, but omits empty strings
506-
pub fn each_split_nonempty(s: &'a str, sepfn: &fn(char) -> bool, it: &fn(&'a str) -> bool) {
524+
pub fn each_split_nonempty<'a>(s: &'a str,
525+
sepfn: &fn(char) -> bool,
526+
it: &fn(&'a str) -> bool) {
507527
each_split_inner(s, sepfn, len(s), false, false, it)
508528
}
509529

510-
fn each_split_inner(s: &'a str, sepfn: &fn(cc: char) -> bool, count: uint,
511-
allow_empty: bool, allow_trailing_empty: bool, it: &fn(&'a str) -> bool) {
530+
fn each_split_inner<'a>(s: &'a str,
531+
sepfn: &fn(cc: char) -> bool,
532+
count: uint,
533+
allow_empty: bool,
534+
allow_trailing_empty: bool,
535+
it: &fn(&'a str) -> bool) {
512536
let l = len(s);
513537
let mut i = 0u, start = 0u, done = 0u;
514538
while i < l && done < count {
@@ -632,15 +656,15 @@ pub fn levdistance(s: &str, t: &str) -> uint {
632656
/**
633657
* Splits a string into substrings separated by LF ('\n').
634658
*/
635-
pub fn each_line(s: &'a str, it: &fn(&'a str) -> bool) {
659+
pub fn each_line<'a>(s: &'a str, it: &fn(&'a str) -> bool) {
636660
each_split_char_no_trailing(s, '\n', it)
637661
}
638662

639663
/**
640664
* Splits a string into substrings separated by LF ('\n')
641665
* and/or CR LF ("\r\n")
642666
*/
643-
pub fn each_line_any(s: &'a str, it: &fn(&'a str) -> bool) {
667+
pub fn each_line_any<'a>(s: &'a str, it: &fn(&'a str) -> bool) {
644668
for each_line(s) |s| {
645669
let l = s.len();
646670
if l > 0u && s[l - 1u] == '\r' as u8 {
@@ -652,7 +676,7 @@ pub fn each_line_any(s: &'a str, it: &fn(&'a str) -> bool) {
652676
}
653677

654678
/// Splits a string into substrings separated by whitespace
655-
pub fn each_word(s: &'a str, it: &fn(&'a str) -> bool) {
679+
pub fn each_word<'a>(s: &'a str, it: &fn(&'a str) -> bool) {
656680
each_split_nonempty(s, char::is_whitespace, it)
657681
}
658682

@@ -665,7 +689,9 @@ pub fn each_word(s: &'a str, it: &fn(&'a str) -> bool) {
665689
* Fails during iteration if the string contains a non-whitespace
666690
* sequence longer than the limit.
667691
*/
668-
pub fn each_split_within(ss: &'a str, lim: uint, it: &fn(&'a str) -> bool) {
692+
pub fn each_split_within<'a>(ss: &'a str,
693+
lim: uint,
694+
it: &fn(&'a str) -> bool) {
669695
// Just for fun, let's write this as an state machine:
670696

671697
enum SplitWithinState {

branches/auto/src/librustc/middle/trans/reachable.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use syntax::{visit, ast_util, ast_map};
3232

3333
pub type map = @LinearSet<node_id>;
3434

35-
struct ctx {
35+
struct ctx<'self> {
3636
exp_map2: resolve::ExportMap2,
3737
tcx: ty::ctxt,
3838
method_map: typeck::method_map,
@@ -152,7 +152,7 @@ fn mk_ty_visitor() -> visit::vt<ctx> {
152152
..*visit::default_visitor()})
153153
}
154154
155-
fn traverse_ty(ty: @Ty, cx: ctx<'a>, v: visit::vt<ctx<'a>>) {
155+
fn traverse_ty<'a>(ty: @Ty, cx: ctx<'a>, v: visit::vt<ctx<'a>>) {
156156
// XXX: it shouldn't be necessary to do this
157157
let rmap: &mut LinearSet<node_id> = cx.rmap;
158158
if rmap.contains(&ty.id) { return; }
@@ -176,7 +176,7 @@ fn traverse_ty(ty: @Ty, cx: ctx<'a>, v: visit::vt<ctx<'a>>) {
176176
}
177177
178178
fn traverse_inline_body(cx: ctx, body: &blk) {
179-
fn traverse_expr(e: @expr, cx: ctx<'a>, v: visit::vt<ctx<'a>>) {
179+
fn traverse_expr<'a>(e: @expr, cx: ctx<'a>, v: visit::vt<ctx<'a>>) {
180180
match e.node {
181181
expr_path(_) => {
182182
match cx.tcx.def_map.find(&e.id) {

branches/auto/src/libstd/base64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub trait ToBase64 {
1616
fn to_base64(&self) -> ~str;
1717
}
1818

19-
static CHARS: [char * 64] = [
19+
static CHARS: [char, ..64] = [
2020
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
2121
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
2222
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',

0 commit comments

Comments
 (0)