Skip to content

Commit 765ea19

Browse files
committed
---
yaml --- r: 79431 b: refs/heads/snap-stage3 c: 3c30ecb h: refs/heads/master i: 79429: a22143c 79427: 95f0b23 79423: ab19176 v: v3
1 parent 5a33190 commit 765ea19

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+232
-549
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: 124eb2119c78651cfaaa7a046a101fa2e20f83ca
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 807408b708a11c9a96b2dc4fedd611276273574f
4+
refs/heads/snap-stage3: 3c30ecb706dc32257d1ec6bdcb0c88eb924483dd
55
refs/heads/try: ac820906c0e53eab79a98ee64f7231f57c3887b4
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/mk/tests.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ tidy:
250250
| grep '^$(S)src/test' -v \
251251
| grep '^$(S)src/libuv' -v \
252252
| grep '^$(S)src/llvm' -v \
253+
| grep '^$(S)src/gyp' -v \
253254
| xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py
254255
$(Q)find $(S)src/etc -name '*.py' \
255256
| xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pub fn run(lib_path: &str,
6363

6464
Result {
6565
status: output.status,
66-
out: str::from_bytes(output.output),
67-
err: str::from_bytes(output.error)
66+
out: str::from_utf8(output.output),
67+
err: str::from_utf8(output.error)
6868
}
6969
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl<'self> ToBase64 for &'self [u8] {
145145
}
146146

147147
unsafe {
148-
str::raw::from_bytes_owned(v)
148+
str::raw::from_utf8_owned(v)
149149
}
150150
}
151151
}
@@ -162,7 +162,7 @@ impl<'self> FromBase64 for &'self str {
162162
* Convert any base64 encoded string (literal, `@`, `&`, or `~`)
163163
* to the byte values it encodes.
164164
*
165-
* You can use the `from_bytes` function in `std::str`
165+
* You can use the `from_utf8` function in `std::str`
166166
* to turn a `[u8]` into a string with characters corresponding to those
167167
* values.
168168
*
@@ -180,7 +180,7 @@ impl<'self> FromBase64 for &'self str {
180180
* printfln!("%s", hello_str);
181181
* let bytes = hello_str.from_base64();
182182
* printfln!("%?", bytes);
183-
* let result_str = str::from_bytes(bytes);
183+
* let result_str = str::from_utf8(bytes);
184184
* printfln!("%s", result_str);
185185
* }
186186
* ~~~

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ impl Bitv {
523523
* with the most significant bits of each byte coming first. Each
524524
* bit becomes true if equal to 1 or false if equal to 0.
525525
*/
526-
pub fn from_bytes(bytes: &[u8]) -> Bitv {
526+
pub fn from_utf8(bytes: &[u8]) -> Bitv {
527527
from_fn(bytes.len() * 8, |i| {
528528
let b = bytes[i / 8] as uint;
529529
let offset = i % 8;
@@ -1275,8 +1275,8 @@ mod tests {
12751275
}
12761276
12771277
#[test]
1278-
fn test_from_bytes() {
1279-
let bitv = from_bytes([0b10110110, 0b00000000, 0b11111111]);
1278+
fn test_from_utf8() {
1279+
let bitv = from_utf8([0b10110110, 0b00000000, 0b11111111]);
12801280
let str = ~"10110110" + "00000000" + "11111111";
12811281
assert_eq!(bitv.to_str(), str);
12821282
}
@@ -1302,7 +1302,7 @@ mod tests {
13021302
#[test]
13031303
fn test_to_bools() {
13041304
let bools = ~[false, false, true, false, false, true, true, false];
1305-
assert_eq!(from_bytes([0b00100110]).to_bools(), bools);
1305+
assert_eq!(from_utf8([0b00100110]).to_bools(), bools);
13061306
}
13071307
13081308
#[test]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ impl Doc {
4141
}
4242

4343
pub fn as_str_slice<'a>(&'a self) -> &'a str {
44-
str::from_bytes_slice(self.data.slice(self.start, self.end))
44+
str::from_utf8_slice(self.data.slice(self.start, self.end))
4545
}
4646

4747
pub fn as_str(&self) -> ~str {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl<'self> ToHex for &'self [u8] {
4545
}
4646

4747
unsafe {
48-
str::raw::from_bytes_owned(v)
48+
str::raw::from_utf8_owned(v)
4949
}
5050
}
5151
}
@@ -62,7 +62,7 @@ impl<'self> FromHex for &'self str {
6262
* Convert any hexadecimal encoded string (literal, `@`, `&`, or `~`)
6363
* to the byte values it encodes.
6464
*
65-
* You can use the `from_bytes` function in `std::str`
65+
* You can use the `from_utf8` function in `std::str`
6666
* to turn a `[u8]` into a string with characters corresponding to those
6767
* values.
6868
*
@@ -80,7 +80,7 @@ impl<'self> FromHex for &'self str {
8080
* printfln!("%s", hello_str);
8181
* let bytes = hello_str.from_hex().unwrap();
8282
* printfln!("%?", bytes);
83-
* let result_str = str::from_bytes(bytes);
83+
* let result_str = str::from_utf8(bytes);
8484
* printfln!("%s", result_str);
8585
* }
8686
* ~~~

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ impl<T : iterator::Iterator<char>> Parser<T> {
858858

859859
/// Decodes a json value from an @io::Reader
860860
pub fn from_reader(rdr: @io::Reader) -> Result<Json, Error> {
861-
let s = str::from_bytes(rdr.read_whole_stream());
861+
let s = str::from_utf8(rdr.read_whole_stream());
862862
let mut parser = Parser(~s.iter());
863863
parser.parse()
864864
}

branches/snap-stage3/src/libextra/terminfo/parser/compiled.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ pub fn parse(file: @Reader, longnames: bool) -> Result<~TermInfo, ~str> {
213213
return Err(~"incompatible file: more string offsets than expected");
214214
}
215215

216-
let names_str = str::from_bytes(file.read_bytes(names_bytes as uint - 1)); // don't read NUL
216+
let names_str = str::from_utf8(file.read_bytes(names_bytes as uint - 1)); // don't read NUL
217217
let term_names: ~[~str] = names_str.split_iter('|').map(|s| s.to_owned()).collect();
218218

219219
file.read_byte(); // consume NUL

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

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -731,13 +731,6 @@ fn run_tests(opts: &TestOpts,
731731
}
732732
}
733733

734-
// Windows tends to dislike being overloaded with threads.
735-
#[cfg(windows)]
736-
static SCHED_OVERCOMMIT : uint = 1;
737-
738-
#[cfg(unix)]
739-
static SCHED_OVERCOMMIT : uint = 4u;
740-
741734
fn get_concurrency() -> uint {
742735
use std::rt;
743736
match os::getenv("RUST_TEST_TASKS") {
@@ -749,9 +742,7 @@ fn get_concurrency() -> uint {
749742
}
750743
}
751744
None => {
752-
let threads = rt::util::default_sched_threads();
753-
if threads == 1 { 1 }
754-
else { threads * SCHED_OVERCOMMIT }
745+
rt::util::default_sched_threads()
755746
}
756747
}
757748
}

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

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,33 @@ fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
321321
Some((value, pos))
322322
}
323323

324+
fn match_fractional_seconds(ss: &str, pos: uint) -> (i32, uint) {
325+
let len = ss.len();
326+
let mut value = 0_i32;
327+
let mut multiplier = NSEC_PER_SEC / 10;
328+
let mut pos = pos;
329+
330+
loop {
331+
if pos >= len {
332+
break;
333+
}
334+
let range = ss.char_range_at(pos);
335+
336+
match range.ch {
337+
'0' .. '9' => {
338+
pos = range.next;
339+
// This will drop digits after the nanoseconds place
340+
let digit = range.ch as i32 - '0' as i32;
341+
value += digit * multiplier;
342+
multiplier /= 10;
343+
}
344+
_ => break
345+
}
346+
}
347+
348+
(value, pos)
349+
}
350+
324351
fn match_digits_in_range(ss: &str, pos: uint, digits: uint, ws: bool,
325352
min: i32, max: i32) -> Option<(i32, uint)> {
326353
match match_digits(ss, pos, digits, ws) {
@@ -441,6 +468,11 @@ fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
441468
Some(item) => { let (v, pos) = item; tm.tm_mday = v; Ok(pos) }
442469
None => Err(~"Invalid day of the month")
443470
},
471+
'f' => {
472+
let (val, pos) = match_fractional_seconds(s, pos);
473+
tm.tm_nsec = val;
474+
Ok(pos)
475+
}
444476
'F' => {
445477
parse_type(s, pos, 'Y', &mut *tm)
446478
.chain(|pos| parse_char(s, pos, '-'))
@@ -773,6 +805,7 @@ fn do_strftime(format: &str, tm: &Tm) -> ~str {
773805
}
774806
'd' => fmt!("%02d", tm.tm_mday as int),
775807
'e' => fmt!("%2d", tm.tm_mday as int),
808+
'f' => fmt!("%09d", tm.tm_nsec as int),
776809
'F' => {
777810
fmt!("%s-%s-%s",
778811
parse_type('Y', tm),
@@ -1011,12 +1044,12 @@ mod tests {
10111044
Err(_) => ()
10121045
}
10131046
1014-
let format = "%a %b %e %T %Y";
1047+
let format = "%a %b %e %T.%f %Y";
10151048
assert_eq!(strptime("", format), Err(~"Invalid time"));
10161049
assert!(strptime("Fri Feb 13 15:31:30", format)
10171050
== Err(~"Invalid time"));
10181051
1019-
match strptime("Fri Feb 13 15:31:30 2009", format) {
1052+
match strptime("Fri Feb 13 15:31:30.01234 2009", format) {
10201053
Err(e) => fail!(e),
10211054
Ok(ref tm) => {
10221055
assert!(tm.tm_sec == 30_i32);
@@ -1030,7 +1063,7 @@ mod tests {
10301063
assert!(tm.tm_isdst == 0_i32);
10311064
assert!(tm.tm_gmtoff == 0_i32);
10321065
assert!(tm.tm_zone == ~"");
1033-
assert!(tm.tm_nsec == 0_i32);
1066+
assert!(tm.tm_nsec == 12340000_i32);
10341067
}
10351068
}
10361069
@@ -1187,6 +1220,7 @@ mod tests {
11871220
assert_eq!(local.strftime("%D"), ~"02/13/09");
11881221
assert_eq!(local.strftime("%d"), ~"13");
11891222
assert_eq!(local.strftime("%e"), ~"13");
1223+
assert_eq!(local.strftime("%f"), ~"000054321");
11901224
assert_eq!(local.strftime("%F"), ~"2009-02-13");
11911225
// assert!(local.strftime("%G") == "2009");
11921226
// assert!(local.strftime("%g") == "09");

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ impl Uuid {
210210
///
211211
/// # Arguments
212212
/// * `b` An array or slice of 16 bytes
213-
pub fn from_bytes(b: &[u8]) -> Option<Uuid> {
213+
pub fn from_utf8(b: &[u8]) -> Option<Uuid> {
214214
if b.len() != 16 {
215215
return None
216216
}
@@ -307,7 +307,7 @@ impl Uuid {
307307
s[i*2+0] = digit[0];
308308
s[i*2+1] = digit[1];
309309
}
310-
str::from_bytes(s)
310+
str::from_utf8(s)
311311
}
312312

313313
/// Returns a string of hexadecimal digits, separated into groups with a hypen
@@ -413,7 +413,7 @@ impl Uuid {
413413
ub[i] = FromStrRadix::from_str_radix(vs.slice(i*2, (i+1)*2), 16).unwrap();
414414
}
415415

416-
Ok(Uuid::from_bytes(ub).unwrap())
416+
Ok(Uuid::from_utf8(ub).unwrap())
417417
}
418418
}
419419

@@ -705,11 +705,11 @@ mod test {
705705
}
706706

707707
#[test]
708-
fn test_from_bytes() {
708+
fn test_from_utf8() {
709709
let b = ~[ 0xa1, 0xa2, 0xa3, 0xa4, 0xb1, 0xb2, 0xc1, 0xc2,
710710
0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8 ];
711711

712-
let u = Uuid::from_bytes(b).unwrap();
712+
let u = Uuid::from_utf8(b).unwrap();
713713
let expected = ~"a1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8";
714714

715715
assert!(u.to_simple_str() == expected);
@@ -729,7 +729,7 @@ mod test {
729729
let b_in: [u8, ..16] = [ 0xa1, 0xa2, 0xa3, 0xa4, 0xb1, 0xb2, 0xc1, 0xc2,
730730
0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8 ];
731731

732-
let u = Uuid::from_bytes(b_in.clone()).unwrap();
732+
let u = Uuid::from_utf8(b_in.clone()).unwrap();
733733

734734
let b_out = u.to_bytes();
735735

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ pub mod write {
386386
cc_prog, prog.status));
387387
sess.note(fmt!("%s arguments: %s",
388388
cc_prog, cc_args.connect(" ")));
389-
sess.note(str::from_bytes(prog.error + prog.output));
389+
sess.note(str::from_utf8(prog.error + prog.output));
390390
sess.abort_if_errors();
391391
}
392392
}
@@ -943,7 +943,7 @@ pub fn link_binary(sess: Session,
943943
cc_prog, prog.status));
944944
sess.note(fmt!("%s arguments: %s",
945945
cc_prog, cc_args.connect(" ")));
946-
sess.note(str::from_bytes(prog.error + prog.output));
946+
sess.note(str::from_utf8(prog.error + prog.output));
947947
sess.abort_if_errors();
948948
}
949949

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,7 @@ fn read_path(d: ebml::Doc) -> (~str, uint) {
12391239
do reader::with_doc_data(d) |desc| {
12401240
let pos = io::u64_from_be_bytes(desc, 0u, 4u) as uint;
12411241
let pathbytes = desc.slice(4u, desc.len());
1242-
let path = str::from_bytes(pathbytes);
1242+
let path = str::from_utf8(pathbytes);
12431243

12441244
(path, pos)
12451245
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ pub fn parse_ident(st: &mut PState, last: char) -> ast::Ident {
9797

9898
fn parse_ident_(st: &mut PState, is_last: @fn(char) -> bool) ->
9999
ast::Ident {
100-
let rslt = scan(st, is_last, str::from_bytes);
100+
let rslt = scan(st, is_last, str::from_utf8);
101101
return st.tcx.sess.ident_of(rslt);
102102
}
103103

@@ -477,7 +477,7 @@ fn parse_abi_set(st: &mut PState) -> AbiSet {
477477
let mut abis = AbiSet::empty();
478478
while peek(st) != ']' {
479479
// FIXME(#5422) str API should not force this copy
480-
let abi_str = scan(st, |c| c == ',', str::from_bytes);
480+
let abi_str = scan(st, |c| c == ',', str::from_utf8);
481481
let abi = abi::lookup(abi_str).expect(abi_str);
482482
abis.add(abi);
483483
}

branches/snap-stage3/src/librustc/rustc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ Available lint options:
161161
max_key = num::max(name.len(), max_key);
162162
}
163163
fn padded(max: uint, s: &str) -> ~str {
164-
str::from_bytes(vec::from_elem(max - s.len(), ' ' as u8)) + s
164+
str::from_utf8(vec::from_elem(max - s.len(), ' ' as u8)) + s
165165
}
166166
println("\nAvailable lint checks:\n");
167167
printfln!(" %s %7.7s %s",
@@ -244,7 +244,7 @@ pub fn run_compiler(args: &[~str], demitter: diagnostic::Emitter) {
244244
1u => {
245245
let ifile = matches.free[0].as_slice();
246246
if "-" == ifile {
247-
let src = str::from_bytes(io::stdin().read_whole_stream());
247+
let src = str::from_utf8(io::stdin().read_whole_stream());
248248
str_input(src.to_managed())
249249
} else {
250250
file_input(Path(ifile))

branches/snap-stage3/src/librustdoc/markdown_writer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ fn pandoc_writer(
116116

117117
debug!("pandoc result: %i", output.status);
118118
if output.status != 0 {
119-
error!("pandoc-out: %s", str::from_bytes(output.output));
120-
error!("pandoc-err: %s", str::from_bytes(output.error));
119+
error!("pandoc-out: %s", str::from_utf8(output.output));
120+
error!("pandoc-err: %s", str::from_utf8(output.error));
121121
fail!("pandoc failed");
122122
}
123123
}

branches/snap-stage3/src/librustpkg/rustpkg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ impl<'self> PkgScript<'self> {
153153
exe.to_str(), sysroot.to_str(), "configs");
154154
let output = run::process_output(exe.to_str(), [sysroot.to_str(), ~"configs"]);
155155
// Run the configs() function to get the configs
156-
let cfgs = str::from_bytes_slice(output.output).word_iter()
156+
let cfgs = str::from_utf8_slice(output.output).word_iter()
157157
.map(|w| w.to_owned()).collect();
158158
(cfgs, output.status)
159159
}

0 commit comments

Comments
 (0)