Skip to content

Commit bf6710b

Browse files
committed
---
yaml --- r: 139326 b: refs/heads/try2 c: f792d17 h: refs/heads/master v: v3
1 parent 88bcd6a commit bf6710b

File tree

149 files changed

+2272
-2072
lines changed

Some content is hidden

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

149 files changed

+2272
-2072
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 5011d05db25fd3dfc0a9dc41fd914633ffb85469
8+
refs/heads/try2: f792d177a493aa3ced268ed4d6815baef5ab8d29
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/doc/rust.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -441,11 +441,11 @@ expression context, the final namespace qualifier is omitted.
441441
Two examples of paths with type arguments:
442442

443443
~~~~
444-
# use core::hashmap::linear::LinearMap;
444+
# use std::oldmap;
445445
# fn f() {
446446
# fn id<T:Copy>(t: T) -> T { t }
447-
type t = LinearMap<int,~str>; // Type arguments used in a type expression
448-
let x = id::<int>(10); // Type arguments used in a call expression
447+
type t = oldmap::HashMap<int,~str>; // Type arguments used in a type expression
448+
let x = id::<int>(10); // Type arguments used in a call expression
449449
# }
450450
~~~~
451451

branches/try2/doc/tutorial.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1829,8 +1829,8 @@ illegal to copy and pass by value.
18291829
Generic `type`, `struct`, and `enum` declarations follow the same pattern:
18301830

18311831
~~~~
1832-
# use core::hashmap::linear::LinearMap;
1833-
type Set<T> = LinearMap<T, ()>;
1832+
# use std::oldmap::HashMap;
1833+
type Set<T> = HashMap<T, ()>;
18341834
18351835
struct Stack<T> {
18361836
elements: ~[T]

branches/try2/src/compiletest/header.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,7 @@ fn parse_check_line(line: ~str) -> Option<~str> {
142142
fn parse_exec_env(line: ~str) -> Option<(~str, ~str)> {
143143
do parse_name_value_directive(line, ~"exec-env").map |nv| {
144144
// nv is either FOO or FOO=BAR
145-
let mut strs = ~[];
146-
for str::each_splitn_char(*nv, '=', 1u) |s| { strs.push(s.to_owned()); }
145+
let strs = str::splitn_char(*nv, '=', 1u);
147146
match strs.len() {
148147
1u => (strs[0], ~""),
149148
2u => (strs[0], strs[1]),

branches/try2/src/compiletest/runtest.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ fn run_debuginfo_test(config: config, props: TestProps, testfile: &Path) {
267267
// check if each line in props.check_lines appears in the
268268
// output (in order)
269269
let mut i = 0u;
270-
for str::each_line(ProcRes.stdout) |line| {
270+
for str::lines_each(ProcRes.stdout) |line| {
271271
if props.check_lines[i].trim() == line.trim() {
272272
i += 1u;
273273
}
@@ -297,7 +297,7 @@ fn check_error_patterns(props: TestProps,
297297
let mut next_err_idx = 0u;
298298
let mut next_err_pat = props.error_patterns[next_err_idx];
299299
let mut done = false;
300-
for str::each_line(ProcRes.stderr) |line| {
300+
for str::lines_each(ProcRes.stderr) |line| {
301301
if str::contains(line, next_err_pat) {
302302
debug!("found error pattern %s", next_err_pat);
303303
next_err_idx += 1u;
@@ -347,7 +347,7 @@ fn check_expected_errors(expected_errors: ~[errors::ExpectedError],
347347
// filename:line1:col1: line2:col2: *warning:* msg
348348
// where line1:col1: is the starting point, line2:col2:
349349
// is the ending point, and * represents ANSI color codes.
350-
for str::each_line(ProcRes.stderr) |line| {
350+
for str::lines_each(ProcRes.stderr) |line| {
351351
let mut was_expected = false;
352352
for vec::eachi(expected_errors) |i, ee| {
353353
if !found_flags[i] {
@@ -596,12 +596,8 @@ fn split_maybe_args(argstr: Option<~str>) -> ~[~str] {
596596
}
597597

598598
match argstr {
599-
Some(s) => {
600-
let mut ss = ~[];
601-
for str::each_split_char(s, ' ') |s| { ss.push(s.to_owned()) }
602-
rm_whitespace(ss)
603-
}
604-
None => ~[]
599+
Some(s) => rm_whitespace(str::split_char(s, ' ')),
600+
None => ~[]
605601
}
606602
}
607603

branches/try2/src/libcore/cast.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! Unsafe casting functions
12-
1311
pub mod rusti {
1412
#[abi = "rust-intrinsic"]
1513
#[link_name = "rusti"]

branches/try2/src/libcore/cell.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,13 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! A mutable, nullable memory location
12-
1311
use cast::transmute;
1412
use option;
1513
use prelude::*;
1614

17-
/*
18-
A dynamic, mutable location.
19-
20-
Similar to a mutable option type, but friendlier.
21-
*/
15+
/// A dynamic, mutable location.
16+
///
17+
/// Similar to a mutable option type, but friendlier.
2218
2319
pub struct Cell<T> {
2420
mut value: Option<T>

branches/try2/src/libcore/clone.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,9 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
/*! The Clone trait for types that cannot be "implicitly copied"
12-
13-
In Rust, some simple types are "implicitly copyable" and when you
14-
assign them or pass them as arguments, the receiver will get a copy,
15-
leaving the original value in place. These types do not require
16-
allocation to copy and do not have finalizers (i.e. they do not
17-
contain owned pointers or implement `Drop`), so the compiler considers
18-
them cheap and safe to copy and automatically implements the `Copy`
19-
trait for them. For other types copies must be made explicitly,
20-
by convention implementing the `Clone` trait and calling the
21-
`clone` method.
22-
11+
/**
12+
Clonable types are copied with the clone method
2313
*/
24-
2514
pub trait Clone {
2615
fn clone(&self) -> Self;
2716
}

branches/try2/src/libcore/comm.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
/*!
12-
Message passing
13-
*/
14-
1511
use cast;
1612
use either::{Either, Left, Right};
1713
use kinds::Owned;

branches/try2/src/libcore/condition.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
/*! Condition handling */
12-
1311
use prelude::*;
1412
use task;
1513
use task::local_data::{local_data_pop, local_data_set};

branches/try2/src/libcore/core.rc

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,39 +10,27 @@
1010

1111
/*!
1212

13-
# The Rust core library
13+
The Rust core library
1414

1515
The Rust core library provides runtime features required by the language,
1616
including the task scheduler and memory allocators, as well as library
1717
support for Rust built-in types, platform abstractions, and other commonly
1818
used features.
1919

2020
`core` includes modules corresponding to each of the integer types, each of
21-
the floating point types, the `bool` type, tuples, characters, strings
22-
(`str`), vectors (`vec`), managed boxes (`managed`), owned boxes (`owned`),
23-
and unsafe and borrowed pointers (`ptr`). Additionally, `core` provides
24-
pervasive types (`option` and `result`), task creation and communication
25-
primitives (`task`, `comm`), platform abstractions (`os` and `path`), basic
26-
I/O abstractions (`io`), common traits (`kinds`, `ops`, `cmp`, `num`,
27-
`to_str`), and complete bindings to the C standard library (`libc`).
21+
the floating point types, the `bool` type, tuples, characters, strings,
22+
vectors (`vec`), managed boxes (`managed`), owned boxes (`owned`), and unsafe
23+
and borrowed pointers (`ptr`). Additionally, `core` provides task management
24+
and creation (`task`), communication primitives (`comm` and `pipes`), platform
25+
abstractions (`os` and `path`), basic I/O abstractions (`io`), common traits
26+
(`cmp`, `num`, `to_str`), and complete bindings to the C standard library
27+
(`libc`).
2828

29-
# Core injection and the Rust prelude
30-
31-
`core` is imported at the topmost level of every crate by default, as
32-
if the first line of each crate was
29+
`core` is linked to all crates by default and its contents imported.
30+
Implicitly, all crates behave as if they included the following prologue:
3331

3432
extern mod core;
35-
36-
This means that the contents of core can be accessed from from any context
37-
with the `core::` path prefix, as in `use core::vec`, `use core::task::spawn`,
38-
etc.
39-
40-
Additionally, `core` contains a `prelude` module that reexports many of the
41-
most common core modules, types and traits. The contents of the prelude are
42-
imported inte every *module* by default. Implicitly, all modules behave as if
43-
they contained the following prologue:
44-
45-
use core::prelude::*;
33+
use core::*;
4634

4735
*/
4836

branches/try2/src/libcore/flate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ Simple compression
1717
use libc;
1818
use libc::{c_void, size_t, c_int};
1919
use ptr;
20+
use rand::RngUtil;
2021
use vec;
2122

2223
#[cfg(test)] use rand;
23-
#[cfg(test)] use rand::RngUtil;
2424

2525
pub mod rustrt {
2626
use libc::{c_int, c_void, size_t};

branches/try2/src/libcore/gc.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#[doc(hidden)];
12+
1113
/*! Precise garbage collector
1214
1315
The precise GC exposes two functions, gc and

branches/try2/src/libcore/hashmap.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -656,11 +656,6 @@ pub mod linear {
656656
fn reserve_at_least(&mut self, n: uint) {
657657
self.map.reserve_at_least(n)
658658
}
659-
660-
/// Consumes all of the elements in the set, emptying it out
661-
fn consume(&mut self, f: &fn(T)) {
662-
self.map.consume(|k, _| f(k))
663-
}
664659
}
665660

666661
#[test]

branches/try2/src/libcore/logging.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
//! Logging
1212
13+
use libc;
14+
1315
pub mod rustrt {
1416
use libc;
1517

@@ -47,7 +49,6 @@ pub fn console_off() {
4749
pub fn log_type<T>(level: u32, object: &T) {
4850
use cast::transmute;
4951
use io;
50-
use libc;
5152
use repr;
5253
use vec;
5354

branches/try2/src/libcore/num/strconv.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,6 @@ impl_NumStrConv_Integer!(u16)
130130
impl_NumStrConv_Integer!(u32)
131131
impl_NumStrConv_Integer!(u64)
132132

133-
134-
// Special value strings as [u8] consts.
135-
static inf_buf: [u8*3] = ['i' as u8, 'n' as u8, 'f' as u8];
136-
static positive_inf_buf: [u8*4] = ['+' as u8, 'i' as u8, 'n' as u8, 'f' as u8];
137-
static negative_inf_buf: [u8*4] = ['-' as u8, 'i' as u8, 'n' as u8, 'f' as u8];
138-
static nan_buf: [u8*3] = ['N' as u8, 'a' as u8, 'N' as u8];
139-
140133
/**
141134
* Converts a number to its string representation as a byte vector.
142135
* This is meant to be a common base implementation for all numeric string
@@ -486,15 +479,15 @@ pub fn from_str_bytes_common<T:NumCast+Zero+One+Ord+Copy+Div<T,T>+
486479
}
487480

488481
if special {
489-
if buf == inf_buf || buf == positive_inf_buf {
482+
if buf == str::inf_buf || buf == str::positive_inf_buf {
490483
return NumStrConv::inf();
491-
} else if buf == negative_inf_buf {
484+
} else if buf == str::negative_inf_buf {
492485
if negative {
493486
return NumStrConv::neg_inf();
494487
} else {
495488
return None;
496489
}
497-
} else if buf == nan_buf {
490+
} else if buf == str::nan_buf {
498491
return NumStrConv::NaN();
499492
}
500493
}

branches/try2/src/libcore/os.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,7 @@ pub fn env() -> ~[(~str,~str)] {
218218
fn env_convert(input: ~[~str]) -> ~[(~str, ~str)] {
219219
let mut pairs = ~[];
220220
for input.each |p| {
221-
let mut vs = ~[];
222-
for str::each_splitn_char(*p, '=', 1) |s| { vs.push(s.to_owned()) }
221+
let vs = str::splitn_char(*p, '=', 1);
223222
debug!("splitting: len: %u",
224223
vs.len());
225224
fail_unless!(vs.len() == 2);

branches/try2/src/libcore/path.rs

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,7 @@ impl ToStr for PosixPath {
381381
impl GenericPath for PosixPath {
382382

383383
fn from_str(s: &str) -> PosixPath {
384-
let mut components = ~[];
385-
for str::each_split_nonempty(s, |c| c == '/') |s| { components.push(s.to_owned()) }
384+
let mut components = str::split_nonempty(s, |c| c == '/');
386385
let is_absolute = (s.len() != 0 && s[0] == '/' as u8);
387386
return PosixPath { is_absolute: is_absolute,
388387
components: components }
@@ -505,10 +504,9 @@ impl GenericPath for PosixPath {
505504
fn push_many(&self, cs: &[~str]) -> PosixPath {
506505
let mut v = copy self.components;
507506
for cs.each |e| {
508-
let mut ss = ~[];
509-
for str::each_split_nonempty(*e, |c| windows::is_sep(c as u8)) |s| {
510-
ss.push(s.to_owned())
511-
}
507+
let mut ss = str::split_nonempty(
508+
*e,
509+
|c| windows::is_sep(c as u8));
512510
unsafe { v.push_all_move(ss); }
513511
}
514512
PosixPath { is_absolute: self.is_absolute,
@@ -517,10 +515,7 @@ impl GenericPath for PosixPath {
517515

518516
fn push(&self, s: &str) -> PosixPath {
519517
let mut v = copy self.components;
520-
let mut ss = ~[];
521-
for str::each_split_nonempty(s, |c| windows::is_sep(c as u8)) |s| {
522-
ss.push(s.to_owned())
523-
}
518+
let mut ss = str::split_nonempty(s, |c| windows::is_sep(c as u8));
524519
unsafe { v.push_all_move(ss); }
525520
PosixPath { components: v, ..copy *self }
526521
}
@@ -595,10 +590,8 @@ impl GenericPath for WindowsPath {
595590
}
596591
}
597592

598-
let mut components = ~[];
599-
for str::each_split_nonempty(rest, |c| windows::is_sep(c as u8)) |s| {
600-
components.push(s.to_owned())
601-
}
593+
let mut components =
594+
str::split_nonempty(rest, |c| windows::is_sep(c as u8));
602595
let is_absolute = (rest.len() != 0 && windows::is_sep(rest[0]));
603596
return WindowsPath { host: host,
604597
device: device,
@@ -766,10 +759,9 @@ impl GenericPath for WindowsPath {
766759
fn push_many(&self, cs: &[~str]) -> WindowsPath {
767760
let mut v = copy self.components;
768761
for cs.each |e| {
769-
let mut ss = ~[];
770-
for str::each_split_nonempty(*e, |c| windows::is_sep(c as u8)) |s| {
771-
ss.push(s.to_owned())
772-
}
762+
let mut ss = str::split_nonempty(
763+
*e,
764+
|c| windows::is_sep(c as u8));
773765
unsafe { v.push_all_move(ss); }
774766
}
775767
// tedious, but as-is, we can't use ..self
@@ -783,10 +775,7 @@ impl GenericPath for WindowsPath {
783775

784776
fn push(&self, s: &str) -> WindowsPath {
785777
let mut v = copy self.components;
786-
let mut ss = ~[];
787-
for str::each_split_nonempty(s, |c| windows::is_sep(c as u8)) |s| {
788-
ss.push(s.to_owned())
789-
}
778+
let mut ss = str::split_nonempty(s, |c| windows::is_sep(c as u8));
790779
unsafe { v.push_all_move(ss); }
791780
return WindowsPath { components: v, ..copy *self }
792781
}

branches/try2/src/libcore/prelude.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! The Rust prelude. Imported into every module by default.
11+
// This file is imported into every module by default.
1212

1313
/* Reexported core operators */
1414

branches/try2/src/libcore/rand.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,7 @@ impl RngUtil for @Rng {
327327
*/
328328
fn gen_char_from(&self, chars: &str) -> char {
329329
fail_unless!(!chars.is_empty());
330-
let mut cs = ~[];
331-
for str::each_char(chars) |c| { cs.push(c) }
332-
self.choose(cs)
330+
self.choose(str::chars(chars))
333331
}
334332

335333
/// Return a random bool

0 commit comments

Comments
 (0)