Skip to content

Commit d09f05a

Browse files
committed
---
yaml --- r: 152765 b: refs/heads/try2 c: e8c12d3 h: refs/heads/master i: 152763: 879a7bf v: v3
1 parent 77cfda5 commit d09f05a

File tree

81 files changed

+910
-333
lines changed

Some content is hidden

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

81 files changed

+910
-333
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: 020373f2c807627274a53251a7841f0e9617e98e
8+
refs/heads/try2: e8c12d32a2e989d02d26a80f91d2c49a8bc1aaad
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/doc/guide-container.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ The standard library provides three owned map/set types:
2626
implement `Eq` and `Hash`
2727
* `collections::TrieMap` and `collections::TrieSet`, requiring the keys to be `uint`
2828
* `collections::TreeMap` and `collections::TreeSet`, requiring the keys
29-
to implement `TotalOrd`
29+
to implement `Ord`
3030

3131
These maps do not use managed pointers so they can be sent between tasks as
3232
long as the key and value types are sendable. Neither the key or value type has

branches/try2/src/doc/rust.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ block_comment_body : [block_comment | character] * ;
160160
line_comment : "//" non_eol * ;
161161
~~~~
162162

163-
Comments in Rust code follow the general C++ style of line and block-comment forms.
163+
Comments in Rust code follow the general C++ style of line and block-comment forms.
164164
Nested block comments are supported.
165165

166166
Line comments beginning with exactly _three_ slashes (`///`), and block
@@ -2270,7 +2270,7 @@ impl<T: PartialEq> PartialEq for Foo<T> {
22702270

22712271
Supported traits for `deriving` are:
22722272

2273-
* Comparison traits: `PartialEq`, `TotalEq`, `PartialOrd`, `TotalOrd`.
2273+
* Comparison traits: `PartialEq`, `Eq`, `PartialOrd`, `Ord`.
22742274
* Serialization: `Encodable`, `Decodable`. These require `serialize`.
22752275
* `Clone`, to create `T` from `&T` via a copy.
22762276
* `Hash`, to iterate over the bytes in a data type.
@@ -3004,7 +3004,7 @@ ten_times(|j| println!("hello, {}", j));
30043004
### While loops
30053005

30063006
~~~~ {.ebnf .gram}
3007-
while_expr : "while" expr '{' block '}' ;
3007+
while_expr : "while" no_struct_literal_expr '{' block '}' ;
30083008
~~~~
30093009

30103010
A `while` loop begins by evaluating the boolean loop conditional expression.
@@ -3071,7 +3071,7 @@ A `continue` expression is only permitted in the body of a loop.
30713071
### For expressions
30723072

30733073
~~~~ {.ebnf .gram}
3074-
for_expr : "for" pat "in" expr '{' block '}' ;
3074+
for_expr : "for" pat "in" no_struct_literal_expr '{' block '}' ;
30753075
~~~~
30763076

30773077
A `for` expression is a syntactic construct for looping over elements
@@ -3105,7 +3105,7 @@ for i in range(0u, 256) {
31053105
### If expressions
31063106

31073107
~~~~ {.ebnf .gram}
3108-
if_expr : "if" expr '{' block '}'
3108+
if_expr : "if" no_struct_literal_expr '{' block '}'
31093109
else_tail ? ;
31103110
31113111
else_tail : "else" [ if_expr
@@ -3126,7 +3126,7 @@ then any `else` block is executed.
31263126
### Match expressions
31273127

31283128
~~~~ {.ebnf .gram}
3129-
match_expr : "match" expr '{' match_arm * '}' ;
3129+
match_expr : "match" no_struct_literal_expr '{' match_arm * '}' ;
31303130
31313131
match_arm : attribute * match_pat "=>" [ expr "," | '{' block '}' ] ;
31323132
@@ -3563,10 +3563,11 @@ There are four varieties of pointer in Rust:
35633563

35643564
* Raw pointers (`*`)
35653565
: Raw pointers are pointers without safety or liveness guarantees.
3566-
Raw pointers are written `*content`,
3567-
for example `*int` means a raw pointer to an integer.
3568-
Copying or dropping a raw pointer has no effect on the lifecycle of any other value.
3569-
Dereferencing a raw pointer or converting it to any other pointer type is an [`unsafe` operation](#unsafe-functions).
3566+
Raw pointers are written as `*const T` or `*mut T`,
3567+
for example `*const int` means a raw pointer to an integer.
3568+
Copying or dropping a raw pointer has no effect on the lifecycle of any
3569+
other value. Dereferencing a raw pointer or converting it to any other
3570+
pointer type is an [`unsafe` operation](#unsafe-functions).
35703571
Raw pointers are generally discouraged in Rust code;
35713572
they exist to support interoperability with foreign code,
35723573
and writing performance-critical or low-level functions.

branches/try2/src/doc/tutorial.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2619,8 +2619,8 @@ fn main() {
26192619
}
26202620
~~~
26212621

2622-
The full list of derivable traits is `PartialEq`, `TotalEq`, `Ord`,
2623-
`TotalOrd`, `Encodable`, `Decodable`, `Clone`,
2622+
The full list of derivable traits is `PartialEq`, `Eq`, `PartialOrd`,
2623+
`Ord`, `Encodable`, `Decodable`, `Clone`,
26242624
`Hash`, `Rand`, `Default`, `Zero`, `FromPrimitive` and `Show`.
26252625

26262626
# Crates and the module system

branches/try2/src/etc/2014-06-rewrite-bytes-macros.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/env python
1+
#!/usr/bin/env python
22
#
33
# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
44
# file at the top-level directory of this distribution and at

branches/try2/src/etc/generate-deriving-span-tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ def write_file(name, string):
119119
('Clone', [], 1),
120120
('PartialEq', [], 2),
121121
('PartialOrd', ['PartialEq'], 8),
122-
('TotalEq', ['PartialEq'], 1),
123-
('TotalOrd', ['TotalEq', 'PartialOrd', 'PartialEq'], 1),
122+
('Eq', ['PartialEq'], 1),
123+
('Ord', ['Eq', 'PartialOrd', 'PartialEq'], 1),
124124
('Show', [], 1),
125125
('Hash', [], 1)]:
126126
traits[trait] = (ALL, supers, errs)

branches/try2/src/etc/vim/syntax/rust.vim

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ syn keyword rustKeyword unsafe virtual while
3030
syn keyword rustKeyword use nextgroup=rustModPath skipwhite skipempty
3131
" FIXME: Scoped impl's name is also fallen in this category
3232
syn keyword rustKeyword mod trait struct enum type nextgroup=rustIdentifier skipwhite skipempty
33-
syn keyword rustStorage mut ref static
34-
syn keyword rustObsoleteStorage const
33+
syn keyword rustStorage mut ref static const
3534

3635
syn keyword rustInvalidBareKeyword crate
3736

@@ -82,7 +81,7 @@ syn keyword rustTrait Ascii AsciiCast OwnedAsciiCast AsciiStr IntoBytes
8281
syn keyword rustTrait ToCStr
8382
syn keyword rustTrait Char
8483
syn keyword rustTrait Clone
85-
syn keyword rustTrait Eq Ord TotalEq TotalOrd Ordering Equiv
84+
syn keyword rustTrait Eq Ord PartialEq PartialOrd Ordering Equiv
8685
syn keyword rustEnumVariant Less Equal Greater
8786
syn keyword rustTrait Container Mutable Map MutableMap Set MutableSet
8887
syn keyword rustTrait FromIterator Extendable
@@ -104,7 +103,7 @@ syn keyword rustTrait Tuple5 Tuple6 Tuple7 Tuple8
104103
syn keyword rustTrait Tuple9 Tuple10 Tuple11 Tuple12
105104
syn keyword rustTrait CloneableVector ImmutableCloneableVector MutableCloneableVector
106105
syn keyword rustTrait ImmutableVector MutableVector
107-
syn keyword rustTrait ImmutableEqVector ImmutableTotalOrdVector MutableTotalOrdVector
106+
syn keyword rustTrait ImmutableEqVector ImmutableOrdVector MutableOrdVector
108107
syn keyword rustTrait Vector VectorVector OwnedVector MutableVectorAllocating
109108
syn keyword rustTrait String
110109
syn keyword rustTrait Vec

branches/try2/src/liballoc/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070

7171
#![no_std]
7272
#![feature(phase, unsafe_destructor)]
73-
#![allow(unknown_features)] // NOTE: remove after a stage0 snap
7473

7574
#[phase(plugin, link)]
7675
extern crate core;

branches/try2/src/libarena/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131
#![feature(unsafe_destructor)]
3232
#![allow(missing_doc)]
33-
#![allow(unknown_features)] // NOTE: remove after a stage0 snap
3433

3534
use std::cell::{Cell, RefCell};
3635
use std::cmp;

branches/try2/src/libcollections/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#![feature(macro_rules, managed_boxes, default_type_params, phase, globs)]
2525
#![feature(unsafe_destructor)]
2626
#![no_std]
27-
#![allow(unknown_features)] // NOTE: remove after a stage0 snap
2827

2928
#[phase(plugin, link)] extern crate core;
3029
extern crate alloc;

branches/try2/src/libcollections/vec.rs

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ impl<T> Vec<T> {
8585
/// # use std::vec::Vec;
8686
/// let vec: Vec<int> = Vec::with_capacity(10);
8787
/// ```
88+
#[inline]
8889
pub fn with_capacity(capacity: uint) -> Vec<T> {
8990
if mem::size_of::<T>() == 0 {
9091
Vec { len: 0, cap: uint::MAX, ptr: 0 as *mut T }
@@ -110,6 +111,7 @@ impl<T> Vec<T> {
110111
/// let vec = Vec::from_fn(3, |idx| idx * 2);
111112
/// assert_eq!(vec, vec!(0, 2, 4));
112113
/// ```
114+
#[inline]
113115
pub fn from_fn(length: uint, op: |uint| -> T) -> Vec<T> {
114116
unsafe {
115117
let mut xs = Vec::with_capacity(length);
@@ -193,6 +195,7 @@ impl<T: Clone> Vec<T> {
193195
/// let slice = [1, 2, 3];
194196
/// let vec = Vec::from_slice(slice);
195197
/// ```
198+
#[inline]
196199
pub fn from_slice(values: &[T]) -> Vec<T> {
197200
values.iter().map(|x| x.clone()).collect()
198201
}
@@ -207,6 +210,7 @@ impl<T: Clone> Vec<T> {
207210
/// let vec = Vec::from_elem(3, "hi");
208211
/// println!("{}", vec); // prints [hi, hi, hi]
209212
/// ```
213+
#[inline]
210214
pub fn from_elem(length: uint, value: T) -> Vec<T> {
211215
unsafe {
212216
let mut xs = Vec::with_capacity(length);
@@ -353,6 +357,7 @@ impl<T:Clone> Clone for Vec<T> {
353357
}
354358

355359
impl<T> FromIterator<T> for Vec<T> {
360+
#[inline]
356361
fn from_iter<I:Iterator<T>>(mut iterator: I) -> Vec<T> {
357362
let (lower, _) = iterator.size_hint();
358363
let mut vector = Vec::with_capacity(lower);
@@ -364,6 +369,7 @@ impl<T> FromIterator<T> for Vec<T> {
364369
}
365370

366371
impl<T> Extendable<T> for Vec<T> {
372+
#[inline]
367373
fn extend<I: Iterator<T>>(&mut self, mut iterator: I) {
368374
let (lower, _) = iterator.size_hint();
369375
self.reserve_additional(lower);
@@ -1029,6 +1035,7 @@ impl<T> Vec<T> {
10291035
/// vec.push_all_move(vec!(box 2, box 3, box 4));
10301036
/// assert_eq!(vec, vec!(box 1, box 2, box 3, box 4));
10311037
/// ```
1038+
#[inline]
10321039
pub fn push_all_move(&mut self, other: Vec<T>) {
10331040
self.extend(other.move_iter());
10341041
}
@@ -1306,6 +1313,7 @@ impl<T:PartialEq> Vec<T> {
13061313
/// let vec = vec!(1, 2, 3);
13071314
/// assert!(vec.contains(&1));
13081315
/// ```
1316+
#[inline]
13091317
pub fn contains(&self, x: &T) -> bool {
13101318
self.as_slice().contains(x)
13111319
}
@@ -1544,8 +1552,11 @@ pub mod raw {
15441552

15451553
#[cfg(test)]
15461554
mod tests {
1555+
extern crate test;
1556+
15471557
use std::prelude::*;
15481558
use std::mem::size_of;
1559+
use test::Bencher;
15491560
use super::{unzip, raw, Vec};
15501561

15511562
#[test]
@@ -1836,4 +1847,111 @@ mod tests {
18361847
let mut v = vec![BadElem(1), BadElem(2), BadElem(0xbadbeef), BadElem(4)];
18371848
v.truncate(0);
18381849
}
1850+
1851+
#[bench]
1852+
fn bench_new(b: &mut Bencher) {
1853+
b.iter(|| {
1854+
let v: Vec<int> = Vec::new();
1855+
assert_eq!(v.capacity(), 0);
1856+
assert!(v.as_slice() == []);
1857+
})
1858+
}
1859+
1860+
#[bench]
1861+
fn bench_with_capacity_0(b: &mut Bencher) {
1862+
b.iter(|| {
1863+
let v: Vec<int> = Vec::with_capacity(0);
1864+
assert_eq!(v.capacity(), 0);
1865+
assert!(v.as_slice() == []);
1866+
})
1867+
}
1868+
1869+
1870+
#[bench]
1871+
fn bench_with_capacity_5(b: &mut Bencher) {
1872+
b.iter(|| {
1873+
let v: Vec<int> = Vec::with_capacity(5);
1874+
assert_eq!(v.capacity(), 5);
1875+
assert!(v.as_slice() == []);
1876+
})
1877+
}
1878+
1879+
#[bench]
1880+
fn bench_with_capacity_100(b: &mut Bencher) {
1881+
b.iter(|| {
1882+
let v: Vec<int> = Vec::with_capacity(100);
1883+
assert_eq!(v.capacity(), 100);
1884+
assert!(v.as_slice() == []);
1885+
})
1886+
}
1887+
1888+
#[bench]
1889+
fn bench_from_fn_0(b: &mut Bencher) {
1890+
b.iter(|| {
1891+
let v: Vec<int> = Vec::from_fn(0, |_| 5);
1892+
assert!(v.as_slice() == []);
1893+
})
1894+
}
1895+
1896+
#[bench]
1897+
fn bench_from_fn_5(b: &mut Bencher) {
1898+
b.iter(|| {
1899+
let v: Vec<int> = Vec::from_fn(5, |_| 5);
1900+
assert!(v.as_slice() == [5, 5, 5, 5, 5]);
1901+
})
1902+
}
1903+
1904+
#[bench]
1905+
fn bench_from_slice_0(b: &mut Bencher) {
1906+
b.iter(|| {
1907+
let v: Vec<int> = Vec::from_slice([]);
1908+
assert!(v.as_slice() == []);
1909+
})
1910+
}
1911+
1912+
#[bench]
1913+
fn bench_from_slice_5(b: &mut Bencher) {
1914+
b.iter(|| {
1915+
let v: Vec<int> = Vec::from_slice([1, 2, 3, 4, 5]);
1916+
assert!(v.as_slice() == [1, 2, 3, 4, 5]);
1917+
})
1918+
}
1919+
1920+
#[bench]
1921+
fn bench_from_iter_0(b: &mut Bencher) {
1922+
b.iter(|| {
1923+
let v0: Vec<int> = vec!();
1924+
let v1: Vec<int> = FromIterator::from_iter(v0.move_iter());
1925+
assert!(v1.as_slice() == []);
1926+
})
1927+
}
1928+
1929+
#[bench]
1930+
fn bench_from_iter_5(b: &mut Bencher) {
1931+
b.iter(|| {
1932+
let v0: Vec<int> = vec!(1, 2, 3, 4, 5);
1933+
let v1: Vec<int> = FromIterator::from_iter(v0.move_iter());
1934+
assert!(v1.as_slice() == [1, 2, 3, 4, 5]);
1935+
})
1936+
}
1937+
1938+
#[bench]
1939+
fn bench_extend_0(b: &mut Bencher) {
1940+
b.iter(|| {
1941+
let v0: Vec<int> = vec!();
1942+
let mut v1: Vec<int> = vec!(1, 2, 3, 4, 5);
1943+
v1.extend(v0.move_iter());
1944+
assert!(v1.as_slice() == [1, 2, 3, 4, 5]);
1945+
})
1946+
}
1947+
1948+
#[bench]
1949+
fn bench_extend_5(b: &mut Bencher) {
1950+
b.iter(|| {
1951+
let v0: Vec<int> = vec!(1, 2, 3, 4, 5);
1952+
let mut v1: Vec<int> = vec!(1, 2, 3, 4, 5);
1953+
v1.extend(v0.move_iter());
1954+
assert!(v1.as_slice() == [1, 2, 3, 4, 5, 1, 2, 3, 4, 5]);
1955+
})
1956+
}
18391957
}

branches/try2/src/libcore/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
#![no_std]
5858
#![feature(globs, macro_rules, managed_boxes, phase, simd, unsafe_destructor)]
5959
#![deny(missing_doc)]
60-
#![allow(unknown_features)] // NOTE: remove after a stage0 snap
6160

6261
#[cfg(test)] extern crate realcore = "core";
6362
#[cfg(test)] extern crate libc;

branches/try2/src/libnative/lib.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,12 @@
5454
html_root_url = "http://doc.rust-lang.org/")]
5555

5656
#![deny(unused_result, unused_must_use)]
57-
#![allow(non_camel_case_types)]
58-
#![allow(deprecated)]
59-
#![allow(unknown_features)] // NOTE: remove after a stage0 snap
60-
#![feature(default_type_params)]
57+
#![allow(non_camel_case_types, deprecated)]
6158

6259
// NB this crate explicitly does *not* allow glob imports, please seriously
6360
// consider whether they're needed before adding that feature here (the
6461
// answer is that you don't need them)
65-
#![feature(macro_rules, unsafe_destructor)]
62+
#![feature(macro_rules, unsafe_destructor, default_type_params)]
6663

6764
extern crate alloc;
6865
extern crate libc;

branches/try2/src/librustc/front/feature_gate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
//! enabled.
1717
//!
1818
//! Features are enabled in programs via the crate-level attributes of
19-
//! #![feature(...)] with a comma-separated list of features.
19+
//! `#![feature(...)]` with a comma-separated list of features.
2020
2121
use middle::lint;
2222

branches/try2/src/librustc/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ This API is completely unstable and subject to change.
2929
html_root_url = "http://doc.rust-lang.org/")]
3030

3131
#![allow(deprecated)]
32-
#![allow(unknown_features)] // NOTE: remove after a stage0 snap
3332
#![feature(macro_rules, globs, struct_variant, managed_boxes, quote)]
3433
#![feature(default_type_params, phase, unsafe_destructor)]
3534

0 commit comments

Comments
 (0)