Skip to content

Commit 16547ae

Browse files
committed
---
yaml --- r: 138239 b: refs/heads/auto c: fa59bb0 h: refs/heads/master i: 138237: 2be1e16 138235: f67a5d9 138231: e5faa7e 138223: 02d5722 138207: 2f2bb60 138175: c16b0f8 138111: 62c3f14 137983: f3dbc29 137727: 9545a10 137215: 4b4d2f9 v: v3
1 parent 8233913 commit 16547ae

File tree

269 files changed

+2274
-3907
lines changed

Some content is hidden

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

269 files changed

+2274
-3907
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: a923b4ff6dcbf201441f820840e402a12d154e6d
16+
refs/heads/auto: fa59bb08699f2b9905adf20f103b6334e73f6b9f
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/mk/crates.mk

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
TARGET_CRATES := libc std green native flate arena glob term semver \
5353
uuid serialize sync getopts collections num test time rand \
54-
url log regex graphviz core rbml rlibc alloc debug rustrt \
54+
url log regex graphviz core rbml rlibc alloc rustrt \
5555
unicode
5656
HOST_CRATES := syntax rustc rustdoc fourcc hexfloat regex_macros fmt_macros \
5757
rustc_llvm rustc_back
@@ -63,20 +63,19 @@ DEPS_libc := core
6363
DEPS_rlibc := core
6464
DEPS_unicode := core
6565
DEPS_alloc := core libc native:jemalloc
66-
DEPS_debug := std
6766
DEPS_rustrt := alloc core libc collections native:rustrt_native
6867
DEPS_std := core libc rand alloc collections rustrt sync unicode \
6968
native:rust_builtin native:backtrace
7069
DEPS_graphviz := std
7170
DEPS_green := std native:context_switch
7271
DEPS_native := std
73-
DEPS_syntax := std term serialize log fmt_macros debug arena libc
72+
DEPS_syntax := std term serialize log fmt_macros arena libc
7473
DEPS_rustc := syntax flate arena serialize getopts rbml \
75-
time log graphviz debug rustc_llvm rustc_back
74+
time log graphviz rustc_llvm rustc_back
7675
DEPS_rustc_llvm := native:rustllvm libc std
7776
DEPS_rustc_back := std syntax rustc_llvm flate log libc
7877
DEPS_rustdoc := rustc native:hoedown serialize getopts \
79-
test time debug
78+
test time
8079
DEPS_flate := std native:miniz
8180
DEPS_arena := std
8281
DEPS_graphviz := std

branches/auto/src/compiletest/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub fn load_errors(re: &Regex, testfile: &Path) -> Vec<ExpectedError> {
3131
fn parse_expected(line_num: uint, line: &str, re: &Regex) -> Option<ExpectedError> {
3232
re.captures(line).and_then(|caps| {
3333
let adjusts = caps.name("adjusts").len();
34-
let kind = caps.name("kind").to_ascii().to_lower().into_string();
34+
let kind = caps.name("kind").to_ascii().to_lowercase().into_string();
3535
let msg = caps.name("msg").trim().to_string();
3636

3737
debug!("line={} kind={} msg={}", line_num, kind, msg);

branches/auto/src/doc/guide.md

Lines changed: 65 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,87 +1496,102 @@ low-level details matter, they really matter. Just remember that `String`s
14961496
allocate memory and control their data, while `&str`s are a reference to
14971497
another string, and you'll be all set.
14981498

1499-
# Vectors
1499+
# Arrays, Vectors, and Slices
15001500

1501-
Like many programming languages, Rust has a list type for when you want a list
1502-
of things. But similar to strings, Rust has different types to represent this
1503-
idea: `Vec<T>` (a 'vector'), `[T, .. N]` (an 'array'), and `&[T]` (a 'slice').
1504-
Whew!
1501+
Like many programming languages, Rust has list types to represent a sequence of
1502+
things. The most basic is the **array**, a fixed-size list of elements of the
1503+
same type. By default, arrays are immutable.
15051504

1506-
Vectors are similar to `String`s: they have a dynamic length, and they
1507-
allocate enough memory to fit. You can create a vector with the `vec!` macro:
1505+
```{rust}
1506+
let a = [1i, 2i, 3i];
1507+
let mut m = [1i, 2i, 3i];
1508+
```
1509+
1510+
You can create an array with a given number of elements, all initialized to the
1511+
same value, with `[val, ..N]` syntax. The compiler ensures that arrays are
1512+
always initialized.
15081513

15091514
```{rust}
1510-
let nums = vec![1i, 2i, 3i];
1515+
let a = [0i, ..20]; // Shorthand for array of 20 elements all initialized to 0
15111516
```
15121517

1513-
Notice that unlike the `println!` macro we've used in the past, we use square
1514-
brackets (`[]`) with `vec!`. Rust allows you to use either in either situation,
1515-
this is just convention.
1518+
Arrays have type `[T,..N]`. We'll talk about this `T` notation later, when we
1519+
cover generics.
15161520

1517-
You can create an array with just square brackets:
1521+
You can get the number of elements in an array `a` with `a.len()`, and use
1522+
`a.iter()` to iterate over them with a for loop. This code will print each
1523+
number in order:
15181524

15191525
```{rust}
1520-
let nums = [1i, 2i, 3i];
1521-
let nums = [1i, ..20]; // Shorthand for an array of 20 elements all initialized to 1
1526+
let a = [1i, 2, 3]; // Only the first item needs a type suffix
1527+
1528+
println!("a has {} elements", a.len());
1529+
for e in a.iter() {
1530+
println!("{}", e);
1531+
}
15221532
```
15231533

1524-
So what's the difference? An array has a fixed size, so you can't add or
1525-
subtract elements:
1534+
You can access a particular element of an array with **subscript notation**:
15261535

1527-
```{rust,ignore}
1528-
let mut nums = vec![1i, 2i, 3i];
1529-
nums.push(4i); // works
1536+
```{rust}
1537+
let names = ["Graydon", "Brian", "Niko"];
15301538
1531-
let mut nums = [1i, 2i, 3i];
1532-
nums.push(4i); // error: type `[int, .. 3]` does not implement any method
1533-
// in scope named `push`
1539+
println!("The second name is: {}", names[1]);
15341540
```
15351541

1536-
The `push()` method lets you append a value to the end of the vector. But
1537-
since arrays have fixed sizes, adding an element doesn't make any sense.
1538-
You can see how it has the exact type in the error message: `[int, .. 3]`.
1539-
An array of `int`s, with length 3.
1542+
Subscripts start at zero, like in most programming languages, so the first name
1543+
is `names[0]` and the second name is `names[1]`. The above example prints
1544+
`The second name is: Brian`. If you try to use a subscript that is not in the
1545+
array, you will get an error: array access is bounds-checked at run-time. Such
1546+
errant access is the source of many bugs in other systems programming
1547+
languages.
15401548

1541-
Similar to `&str`, a slice is a reference to another array. We can get a
1542-
slice from a vector by using the `as_slice()` method:
1549+
A **vector** is a dynamic or "growable" array, implemented as the standard
1550+
library type [`Vec<T>`](std/vec/) (we'll talk about what the `<T>` means
1551+
later). Vectors are to arrays what `String` is to `&str`. You can create them
1552+
with the `vec!` macro:
15431553

15441554
```{rust}
1545-
let vec = vec![1i, 2i, 3i];
1546-
let slice = vec.as_slice();
1555+
let v = vec![1i, 2, 3];
15471556
```
15481557

1549-
All three types implement an `iter()` method, which returns an iterator. We'll
1550-
talk more about the details of iterators later, but for now, the `iter()` method
1551-
allows you to write a `for` loop that prints out the contents of a vector, array,
1552-
or slice:
1558+
(Notice that unlike the `println!` macro we've used in the past, we use square
1559+
brackets `[]` with `vec!`. Rust allows you to use either in either situation,
1560+
this is just convention.)
15531561

1554-
```{rust}
1555-
let vec = vec![1i, 2i, 3i];
1562+
You can get the length of, iterate over, and subscript vectors just like
1563+
arrays. In addition, (mutable) vectors can grow automatically:
15561564

1557-
for i in vec.iter() {
1558-
println!("{}", i);
1559-
}
1565+
```{rust}
1566+
let mut nums = vec![1i, 2, 3];
1567+
nums.push(4);
1568+
println!("The length of nums is now {}", nums.len()); // Prints 4
15601569
```
15611570

1562-
This code will print each number in order, on its own line.
1571+
Vectors have many more useful methods.
15631572

1564-
You can access a particular element of a vector, array, or slice by using
1565-
**subscript notation**:
1573+
A **slice** is a reference to (or "view" into) an array. They are useful for
1574+
allowing safe, efficient access to a portion of an array without copying. For
1575+
example, you might want to reference just one line of a file read into memory.
1576+
By nature, a slice is not created directly, but from an existing variable.
1577+
Slices have a length, can be mutable or not, and in many ways behave like
1578+
arrays:
15661579

15671580
```{rust}
1568-
let names = ["Graydon", "Brian", "Niko"];
1581+
let a = [0i, 1, 2, 3, 4];
1582+
let middle = a.slice(1, 4); // A slice of a: just the elements [1,2,3]
15691583
1570-
println!("The second name is: {}", names[1]);
1584+
for e in middle.iter() {
1585+
println!("{}", e); // Prints 1, 2, 3
1586+
}
15711587
```
15721588

1573-
These subscripts start at zero, like in most programming languages, so the
1574-
first name is `names[0]` and the second name is `names[1]`. The above example
1575-
prints `The second name is: Brian`.
1589+
You can also take a slice of a vector, `String`, or `&str`, because they are
1590+
backed by arrays. Slices have type `&[T]`, which we'll talk about when we cover
1591+
generics.
15761592

1577-
There's a whole lot more to vectors, but that's enough to get started. We have
1578-
now learned all of the most basic Rust concepts. We're ready to start building
1579-
our guessing game, but we need to know how to do one last thing first: get
1593+
We have now learned all of the most basic Rust concepts. We're ready to start
1594+
building our guessing game, we just need to know one last thing: how to get
15801595
input from the keyboard. You can't have a guessing game without the ability to
15811596
guess!
15821597

branches/auto/src/doc/reference.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,7 @@ This is a list of behaviour not considered *unsafe* in Rust terms, but that may
11771177
be undesired.
11781178

11791179
* Deadlocks
1180-
* Reading data from private fields (`std::repr`, `format!("{:?}", x)`)
1180+
* Reading data from private fields (`std::repr`)
11811181
* Leaks due to reference count cycles, even in the global heap
11821182
* Exiting without calling destructors
11831183
* Sending signals
@@ -2279,8 +2279,6 @@ These types help drive the compiler's analysis
22792279
: The lifetime parameter should be considered invariant
22802280
* `malloc`
22812281
: Allocate memory on the managed heap.
2282-
* `opaque`
2283-
: ___Needs filling in___
22842282
* `owned_box`
22852283
: ___Needs filling in___
22862284
* `stack_exhausted`
@@ -2295,8 +2293,6 @@ These types help drive the compiler's analysis
22952293
: The type parameter should be considered invariant
22962294
* `ty_desc`
22972295
: ___Needs filling in___
2298-
* `ty_visitor`
2299-
: ___Needs filling in___
23002296

23012297
> **Note:** This list is likely to become out of date. We should auto-generate
23022298
> it from `librustc/middle/lang_items.rs`.

branches/auto/src/liballoc/arc.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,6 @@ mod tests {
317317

318318
assert_eq!((*arc_v)[2], 3);
319319
assert_eq!((*arc_v)[4], 5);
320-
321-
info!("{:?}", arc_v);
322320
}
323321

324322
#[test]

branches/auto/src/liballoc/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ extern crate libc;
7777

7878
// Allow testing this library
7979

80-
#[cfg(test)] extern crate debug;
8180
#[cfg(test)] extern crate native;
8281
#[cfg(test)] #[phase(plugin, link)] extern crate std;
8382
#[cfg(test)] #[phase(plugin, link)] extern crate log;

branches/auto/src/libcollections/hash/sip.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ mod tests {
402402
debug!("siphash test {}: {}", t, buf);
403403
let vec = u8to64_le!(vecs[t], 0);
404404
let out = hash_with_keys(k0, k1, &Bytes(buf.as_slice()));
405-
debug!("got {:?}, expected {:?}", out, vec);
405+
debug!("got {}, expected {}", out, vec);
406406
assert_eq!(vec, out);
407407

408408
state_full.reset();
@@ -412,9 +412,6 @@ mod tests {
412412
let v = to_hex_str(&vecs[t]);
413413
debug!("{}: ({}) => inc={} full={}", t, v, i, f);
414414

415-
debug!("full state {:?}", state_full);
416-
debug!("inc state {:?}", state_inc);
417-
418415
assert_eq!(f, i);
419416
assert_eq!(f, v);
420417

branches/auto/src/libcollections/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ extern crate alloc;
3333

3434
#[cfg(test)] extern crate native;
3535
#[cfg(test)] extern crate test;
36-
#[cfg(test)] extern crate debug;
3736

3837
#[cfg(test)] #[phase(plugin, link)] extern crate std;
3938
#[cfg(test)] #[phase(plugin, link)] extern crate log;

branches/auto/src/libcollections/ringbuf.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -551,21 +551,21 @@ mod tests {
551551
assert_eq!(d.len(), 3u);
552552
d.push(137);
553553
assert_eq!(d.len(), 4u);
554-
debug!("{:?}", d.front());
554+
debug!("{}", d.front());
555555
assert_eq!(*d.front().unwrap(), 42);
556-
debug!("{:?}", d.back());
556+
debug!("{}", d.back());
557557
assert_eq!(*d.back().unwrap(), 137);
558558
let mut i = d.pop_front();
559-
debug!("{:?}", i);
559+
debug!("{}", i);
560560
assert_eq!(i, Some(42));
561561
i = d.pop();
562-
debug!("{:?}", i);
562+
debug!("{}", i);
563563
assert_eq!(i, Some(137));
564564
i = d.pop();
565-
debug!("{:?}", i);
565+
debug!("{}", i);
566566
assert_eq!(i, Some(137));
567567
i = d.pop();
568-
debug!("{:?}", i);
568+
debug!("{}", i);
569569
assert_eq!(i, Some(17));
570570
assert_eq!(d.len(), 0u);
571571
d.push(3);
@@ -576,10 +576,10 @@ mod tests {
576576
assert_eq!(d.len(), 3u);
577577
d.push_front(1);
578578
assert_eq!(d.len(), 4u);
579-
debug!("{:?}", d.get(0));
580-
debug!("{:?}", d.get(1));
581-
debug!("{:?}", d.get(2));
582-
debug!("{:?}", d.get(3));
579+
debug!("{}", d.get(0));
580+
debug!("{}", d.get(1));
581+
debug!("{}", d.get(2));
582+
debug!("{}", d.get(3));
583583
assert_eq!(*d.get(0), 1);
584584
assert_eq!(*d.get(1), 2);
585585
assert_eq!(*d.get(2), 3);

branches/auto/src/libcollections/slice.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ use vec::Vec;
101101

102102
pub use core::slice::{Chunks, AsSlice, ImmutableSlice, ImmutablePartialEqSlice};
103103
pub use core::slice::{ImmutableOrdSlice, MutableSlice, Items, MutItems};
104+
pub use core::slice::{ImmutableIntSlice, MutableIntSlice};
104105
pub use core::slice::{MutSplits, MutChunks, Splits};
105106
pub use core::slice::{bytes, mut_ref_slice, ref_slice, MutableCloneableSlice};
106107
pub use core::slice::{Found, NotFound};

branches/auto/src/libcollections/vec.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -453,13 +453,13 @@ impl<T> Index<uint,T> for Vec<T> {
453453
}
454454
}
455455

456-
// FIXME(#12825) Indexing will always try IndexMut first and that causes issues.
457-
/*impl<T> IndexMut<uint,T> for Vec<T> {
456+
#[cfg(not(stage0))]
457+
impl<T> IndexMut<uint,T> for Vec<T> {
458458
#[inline]
459459
fn index_mut<'a>(&'a mut self, index: &uint) -> &'a mut T {
460460
self.get_mut(*index)
461461
}
462-
}*/
462+
}
463463

464464
impl<T> ops::Slice<uint, [T]> for Vec<T> {
465465
#[inline]
@@ -2154,7 +2154,6 @@ impl<T> Vec<T> {
21542154
}
21552155
}
21562156

2157-
21582157
#[cfg(test)]
21592158
mod tests {
21602159
extern crate test;

branches/auto/src/libcore/intrinsics.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,21 @@ pub struct TyDesc {
5858
pub drop_glue: GlueFn,
5959

6060
// Called by reflection visitor to visit a value of type `T`
61+
#[cfg(stage0)]
6162
pub visit_glue: GlueFn,
6263

6364
// Name corresponding to the type
6465
pub name: &'static str,
6566
}
6667

68+
#[cfg(stage0)]
6769
#[lang="opaque"]
6870
pub enum Opaque { }
6971

72+
#[cfg(stage0)]
7073
pub type Disr = u64;
7174

75+
#[cfg(stage0)]
7276
#[lang="ty_visitor"]
7377
pub trait TyVisitor {
7478
fn visit_bot(&mut self) -> bool;
@@ -327,8 +331,6 @@ extern "rust-intrinsic" {
327331
/// Returns `true` if a type is managed (will be allocated on the local heap)
328332
pub fn owns_managed<T>() -> bool;
329333

330-
pub fn visit_tydesc(td: *const TyDesc, tv: &mut TyVisitor);
331-
332334
/// Calculates the offset from a pointer. The offset *must* be in-bounds of
333335
/// the object, or one-byte-past-the-end. An arithmetic overflow is also
334336
/// undefined behaviour.

0 commit comments

Comments
 (0)