Skip to content

Commit 8233913

Browse files
committed
---
yaml --- r: 138238 b: refs/heads/auto c: a923b4f h: refs/heads/master v: v3
1 parent 2be1e16 commit 8233913

File tree

269 files changed

+3908
-2275
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

+3908
-2275
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: 0f8df80804b2c7e89acc3c8e046a1ac7a90124f6
16+
refs/heads/auto: a923b4ff6dcbf201441f820840e402a12d154e6d
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: 5 additions & 4 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 rustrt \
54+
url log regex graphviz core rbml rlibc alloc debug rustrt \
5555
unicode
5656
HOST_CRATES := syntax rustc rustdoc fourcc hexfloat regex_macros fmt_macros \
5757
rustc_llvm rustc_back
@@ -63,19 +63,20 @@ DEPS_libc := core
6363
DEPS_rlibc := core
6464
DEPS_unicode := core
6565
DEPS_alloc := core libc native:jemalloc
66+
DEPS_debug := std
6667
DEPS_rustrt := alloc core libc collections native:rustrt_native
6768
DEPS_std := core libc rand alloc collections rustrt sync unicode \
6869
native:rust_builtin native:backtrace
6970
DEPS_graphviz := std
7071
DEPS_green := std native:context_switch
7172
DEPS_native := std
72-
DEPS_syntax := std term serialize log fmt_macros arena libc
73+
DEPS_syntax := std term serialize log fmt_macros debug arena libc
7374
DEPS_rustc := syntax flate arena serialize getopts rbml \
74-
time log graphviz rustc_llvm rustc_back
75+
time log graphviz debug rustc_llvm rustc_back
7576
DEPS_rustc_llvm := native:rustllvm libc std
7677
DEPS_rustc_back := std syntax rustc_llvm flate log libc
7778
DEPS_rustdoc := rustc native:hoedown serialize getopts \
78-
test time
79+
test time debug
7980
DEPS_flate := std native:miniz
8081
DEPS_arena := std
8182
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_lowercase().into_string();
34+
let kind = caps.name("kind").to_ascii().to_lower().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: 50 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,102 +1496,87 @@ 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-
# Arrays, Vectors, and Slices
1499+
# Vectors
15001500

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.
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!
15041505

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.
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:
15131508

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

1518-
Arrays have type `[T,..N]`. We'll talk about this `T` notation later, when we
1519-
cover generics.
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.
15201516

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:
1517+
You can create an array with just square brackets:
15241518

15251519
```{rust}
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-
}
1520+
let nums = [1i, 2i, 3i];
1521+
let nums = [1i, ..20]; // Shorthand for an array of 20 elements all initialized to 1
15321522
```
15331523

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

1536-
```{rust}
1537-
let names = ["Graydon", "Brian", "Niko"];
1527+
```{rust,ignore}
1528+
let mut nums = vec![1i, 2i, 3i];
1529+
nums.push(4i); // works
15381530
1539-
println!("The second name is: {}", names[1]);
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`
15401534
```
15411535

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.
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.
15481540

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:
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:
15531543

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

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.)
1561-
1562-
You can get the length of, iterate over, and subscript vectors just like
1563-
arrays. In addition, (mutable) vectors can grow automatically:
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:
15641553

15651554
```{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
1555+
let vec = vec![1i, 2i, 3i];
1556+
1557+
for i in vec.iter() {
1558+
println!("{}", i);
1559+
}
15691560
```
15701561

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

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:
1564+
You can access a particular element of a vector, array, or slice by using
1565+
**subscript notation**:
15791566

15801567
```{rust}
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]
1568+
let names = ["Graydon", "Brian", "Niko"];
15831569
1584-
for e in middle.iter() {
1585-
println!("{}", e); // Prints 1, 2, 3
1586-
}
1570+
println!("The second name is: {}", names[1]);
15871571
```
15881572

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.
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`.
15921576

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
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
15951580
input from the keyboard. You can't have a guessing game without the ability to
15961581
guess!
15971582

branches/auto/src/doc/reference.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ following forms:
341341
escaped in order to denote its ASCII encoding `0x5C`.
342342

343343
Raw byte string literals do not process any escapes. They start with the
344-
character `U+0072` (`r`), followed by `U+0062` (`b`), followed by zero or more
344+
character `U+0062` (`b`), followed by `U+0072` (`r`), followed by zero or more
345345
of the character `U+0023` (`#`), and a `U+0022` (double-quote) character. The
346346
_raw string body_ is not defined in the EBNF grammar above: it can contain any
347347
sequence of ASCII characters and is terminated only by another `U+0022`
@@ -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`)
1180+
* Reading data from private fields (`std::repr`, `format!("{:?}", x)`)
11811181
* Leaks due to reference count cycles, even in the global heap
11821182
* Exiting without calling destructors
11831183
* Sending signals
@@ -2279,6 +2279,8 @@ 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___
22822284
* `owned_box`
22832285
: ___Needs filling in___
22842286
* `stack_exhausted`
@@ -2293,6 +2295,8 @@ These types help drive the compiler's analysis
22932295
: The type parameter should be considered invariant
22942296
* `ty_desc`
22952297
: ___Needs filling in___
2298+
* `ty_visitor`
2299+
: ___Needs filling in___
22962300

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

branches/auto/src/liballoc/arc.rs

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

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

322324
#[test]

branches/auto/src/liballoc/lib.rs

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

7878
// Allow testing this library
7979

80+
#[cfg(test)] extern crate debug;
8081
#[cfg(test)] extern crate native;
8182
#[cfg(test)] #[phase(plugin, link)] extern crate std;
8283
#[cfg(test)] #[phase(plugin, link)] extern crate log;

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

Lines changed: 4 additions & 1 deletion
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,6 +412,9 @@ 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+
415418
assert_eq!(f, i);
416419
assert_eq!(f, v);
417420

branches/auto/src/libcollections/lib.rs

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

3434
#[cfg(test)] extern crate native;
3535
#[cfg(test)] extern crate test;
36+
#[cfg(test)] extern crate debug;
3637

3738
#[cfg(test)] #[phase(plugin, link)] extern crate std;
3839
#[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: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ 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};
105104
pub use core::slice::{MutSplits, MutChunks, Splits};
106105
pub use core::slice::{bytes, mut_ref_slice, ref_slice, MutableCloneableSlice};
107106
pub use core::slice::{Found, NotFound};

branches/auto/src/libcollections/vec.rs

Lines changed: 4 additions & 3 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-
#[cfg(not(stage0))]
457-
impl<T> IndexMut<uint,T> for Vec<T> {
456+
// FIXME(#12825) Indexing will always try IndexMut first and that causes issues.
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,6 +2154,7 @@ impl<T> Vec<T> {
21542154
}
21552155
}
21562156

2157+
21572158
#[cfg(test)]
21582159
mod tests {
21592160
extern crate test;

branches/auto/src/libcore/intrinsics.rs

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

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

6463
// Name corresponding to the type
6564
pub name: &'static str,
6665
}
6766

68-
#[cfg(stage0)]
6967
#[lang="opaque"]
7068
pub enum Opaque { }
7169

72-
#[cfg(stage0)]
7370
pub type Disr = u64;
7471

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

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

0 commit comments

Comments
 (0)