Skip to content

Commit 52f2cdb

Browse files
committed
---
yaml --- r: 204991 b: refs/heads/tmp c: dec4225 h: refs/heads/master i: 204989: 85c5912 204987: c44a394 204983: bbdd735 204975: 9e32c1a 204959: 322ac73 204927: dbcecbe v: v3
1 parent 8a6961f commit 52f2cdb

File tree

46 files changed

+390
-140
lines changed

Some content is hidden

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

46 files changed

+390
-140
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3232
refs/heads/beta: f0213d8ffb128a16f94af7ee985dc61484596163
3333
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3434
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
35-
refs/heads/tmp: 6a19046423b49672bc71eb07149ae9ef32bc8af5
35+
refs/heads/tmp: dec422541ba8f325c63f6fe139efb14e0f6f69a0
3636
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3737
refs/tags/homu-tmp: f0ac7e04e647381e2bb87de1f3d0b108acb24d06
3838
refs/heads/gate: 97c84447b65164731087ea82685580cc81424412

branches/tmp/src/doc/reference.md

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -653,9 +653,10 @@ There are several kinds of item:
653653
* [`use` declarations](#use-declarations)
654654
* [modules](#modules)
655655
* [functions](#functions)
656-
* [type definitions](#type-definitions)
656+
* [type aliases](#type-aliases)
657657
* [structures](#structures)
658658
* [enumerations](#enumerations)
659+
* [constant items](#constant-items)
659660
* [static items](#static-items)
660661
* [traits](#traits)
661662
* [implementations](#implementations)
@@ -672,16 +673,16 @@ which sub-item declarations may appear.
672673

673674
### Type Parameters
674675

675-
All items except modules may be *parameterized* by type. Type parameters are
676-
given as a comma-separated list of identifiers enclosed in angle brackets
677-
(`<...>`), after the name of the item and before its definition. The type
678-
parameters of an item are considered "part of the name", not part of the type
679-
of the item. A referencing [path](#paths) must (in principle) provide type
680-
arguments as a list of comma-separated types enclosed within angle brackets, in
681-
order to refer to the type-parameterized item. In practice, the type-inference
682-
system can usually infer such argument types from context. There are no
683-
general type-parametric types, only type-parametric items. That is, Rust has
684-
no notion of type abstraction: there are no first-class "forall" types.
676+
All items except modules, constants and statics may be *parameterized* by type.
677+
Type parameters are given as a comma-separated list of identifiers enclosed in
678+
angle brackets (`<...>`), after the name of the item and before its definition.
679+
The type parameters of an item are considered "part of the name", not part of
680+
the type of the item. A referencing [path](#paths) must (in principle) provide
681+
type arguments as a list of comma-separated types enclosed within angle
682+
brackets, in order to refer to the type-parameterized item. In practice, the
683+
type-inference system can usually infer such argument types from context. There
684+
are no general type-parametric types, only type-parametric items. That is, Rust
685+
has no notion of type abstraction: there are no first-class "forall" types.
685686

686687
### Modules
687688

@@ -743,7 +744,7 @@ mod thread {
743744
}
744745
```
745746

746-
##### Extern crate declarations
747+
#### Extern crate declarations
747748

748749
An _`extern crate` declaration_ specifies a dependency on an external crate.
749750
The external crate is then bound into the declaring scope as the `ident`
@@ -767,7 +768,7 @@ extern crate std; // equivalent to: extern crate std as std;
767768
extern crate std as ruststd; // linking to 'std' under another name
768769
```
769770

770-
##### Use declarations
771+
#### Use declarations
771772

772773
A _use declaration_ creates one or more local name bindings synonymous with
773774
some other [path](#paths). Usually a `use` declaration is used to shorten the
@@ -842,7 +843,7 @@ module declarations should be at the crate root if direct usage of the declared
842843
modules within `use` items is desired. It is also possible to use `self` and
843844
`super` at the beginning of a `use` item to refer to the current and direct
844845
parent modules respectively. All rules regarding accessing declared modules in
845-
`use` declarations applies to both module declarations and `extern crate`
846+
`use` declarations apply to both module declarations and `extern crate`
846847
declarations.
847848

848849
An example of what will and will not work for `use` items:
@@ -2564,12 +2565,19 @@ array is mutable, the resulting [lvalue](#lvalues,-rvalues-and-temporaries) can
25642565
be assigned to.
25652566

25662567
Indices are zero-based, and may be of any integral type. Vector access is
2567-
bounds-checked at run-time. When the check fails, it will put the thread in a
2568-
_panicked state_.
2568+
bounds-checked at compile-time for constant arrays being accessed with a constant index value.
2569+
Otherwise a check will be performed at run-time that will put the thread in a _panicked state_ if it fails.
25692570

25702571
```{should-fail}
25712572
([1, 2, 3, 4])[0];
2572-
(["a", "b"])[10]; // panics
2573+
2574+
let x = (["a", "b"])[10]; // compiler error: const index-expr is out of bounds
2575+
2576+
let n = 10;
2577+
let y = (["a", "b"])[n]; // panics
2578+
2579+
let arr = ["a", "b"];
2580+
arr[10]; // panics
25732581
```
25742582

25752583
### Range expressions

branches/tmp/src/doc/trpl/guessing-game.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ information’. Why throw it away? Well, for a basic program, we just want to
273273
print a generic error, as basically any issue means we can’t continue. The
274274
[`ok()` method][ok] returns a value which has another method defined on it:
275275
`expect()`. The [`expect()` method][expect] takes a value it’s called on, and
276-
if it isn’t a successful one, [`panic!`][panic]s with a message you passed you
276+
if it isn’t a successful one, [`panic!`][panic]s with a message you
277277
passed it. A `panic!` like this will cause our program to crash, displaying
278278
the message.
279279

@@ -713,7 +713,7 @@ variety of numbers, we need to give Rust a hint as to the exact type of number
713713
we want. Hence, `let guess: u32`. The colon (`:`) after `guess` tells Rust
714714
we’re going to annotate its type. `u32` is an unsigned, thirty-two bit
715715
integer. Rust has [a number of built-in number types][number], but we’ve
716-
chosen `u32`. It’s a good default choice for a small positive numer.
716+
chosen `u32`. It’s a good default choice for a small positive number.
717717
718718
[parse]: ../std/primitive.str.html#method.parse
719719
[number]: primitive-types.html#numeric-types
@@ -922,7 +922,7 @@ failure. Each contains more information: the successful parsed integer, or an
922922
error type. In this case, we `match` on `Ok(num)`, which sets the inner value
923923
of the `Ok` to the name `num`, and then we just return it on the right-hand
924924
side. In the `Err` case, we don’t care what kind of error it is, so we just
925-
use `_` intead of a name. This ignores the error, and `continue` causes us
925+
use `_` instead of a name. This ignores the error, and `continue` causes us
926926
to go to the next iteration of the `loop`.
927927
928928
Now we should be good! Let’s try:

branches/tmp/src/doc/trpl/match.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ side of a `let` binding or directly where an expression is used:
5050
```rust
5151
let x = 5;
5252

53-
let numer = match x {
53+
let number = match x {
5454
1 => "one",
5555
2 => "two",
5656
3 => "three",

branches/tmp/src/doc/trpl/mutability.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ When we call `clone()`, the `Arc<T>` needs to update the reference count. Yet
7878
we’ve not used any `mut`s here, `x` is an immutable binding, and we didn’t take
7979
`&mut 5` or anything. So what gives?
8080

81-
To this, we have to go back to the core of Rust’s guiding philosophy, memory
82-
safety, and the mechanism by which Rust guarantees it, the
81+
To understand this, we have to go back to the core of Rust’s guiding
82+
philosophy, memory safety, and the mechanism by which Rust guarantees it, the
8383
[ownership][ownership] system, and more specifically, [borrowing][borrowing]:
8484

8585
> You may have one or the other of these two kinds of borrows, but not both at
@@ -169,7 +169,7 @@ struct Point {
169169
y: Cell<i32>,
170170
}
171171
172-
let mut point = Point { x: 5, y: Cell::new(6) };
172+
let point = Point { x: 5, y: Cell::new(6) };
173173
174174
point.y.set(7);
175175

branches/tmp/src/doc/trpl/ownership.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ fn foo(v: Vec<i32>) -> Vec<i32> {
174174
}
175175
```
176176

177-
This would get very tedius. It gets worse the more things we want to take ownership of:
177+
This would get very tedious. It gets worse the more things we want to take ownership of:
178178

179179
```rust
180180
fn foo(v1: Vec<i32>, v2: Vec<i32>) -> (Vec<i32>, Vec<i32>, i32) {

branches/tmp/src/doc/trpl/primitive-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ Slices have type `&[T]`. We’ll talk about that `T` when we cover
176176

177177
[generics]: generics.html
178178

179-
You can find more documentation for `slices`s [in the standard library
179+
You can find more documentation for slices [in the standard library
180180
documentation][slice].
181181

182182
[slice]: ../std/primitive.slice.html

branches/tmp/src/doc/trpl/references-and-borrowing.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ become quite acquainted. Ownership is how Rust achieves its largest goal,
66
memory safety. There are a few distinct concepts, each with its own
77
chapter:
88

9-
* [ownership][ownership], ownership, the key concept
9+
* [ownership][ownership], the key concept
1010
* borrowing, which you’re reading now
1111
* [lifetimes][lifetimes], an advanced concept of borrowing
1212

@@ -312,6 +312,7 @@ println!("{}", y);
312312

313313
We get this error:
314314

315+
```text
315316
error: `x` does not live long enough
316317
y = &x;
317318
^
@@ -334,3 +335,37 @@ In other words, `y` is only valid for the scope where `x` exists. As soon as
334335
`x` goes away, it becomes invalid to refer to it. As such, the error says that
335336
the borrow ‘doesn’t live long enough’ because it’s not valid for the right
336337
amount of time.
338+
339+
The same problem occurs when the reference is declared _before_ the variable it refers to:
340+
341+
```rust,ignore
342+
let y: &i32;
343+
let x = 5;
344+
y = &x;
345+
346+
println!("{}", y);
347+
```
348+
349+
We get this error:
350+
351+
```text
352+
error: `x` does not live long enough
353+
y = &x;
354+
^
355+
note: reference must be valid for the block suffix following statement 0 at
356+
2:16...
357+
let y: &i32;
358+
let x = 5;
359+
y = &x;
360+
361+
println!("{}", y);
362+
}
363+
364+
note: ...but borrowed value is only valid for the block suffix following
365+
statement 1 at 3:14
366+
let x = 5;
367+
y = &x;
368+
369+
println!("{}", y);
370+
}
371+
```

branches/tmp/src/etc/CONFIGS.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
# Configs
22

3-
Here are some links to repos with configs which ease the use of rust:
3+
These are some links to repos with configs which ease the use of rust.
4+
5+
## Officially Maintained Configs
46

57
* [rust.vim](https://github.com/rust-lang/rust.vim)
68
* [emacs rust-mode](https://github.com/rust-lang/rust-mode)
79
* [gedit-config](https://github.com/rust-lang/gedit-config)
810
* [kate-config](https://github.com/rust-lang/kate-config)
911
* [nano-config](https://github.com/rust-lang/nano-config)
1012
* [zsh-config](https://github.com/rust-lang/zsh-config)
13+
14+
## Community-maintained Configs
15+
16+
* [.editorconfig](https://gist.github.com/derhuerst/c9d1b9309e308d9851fa) ([what is this?](http://editorconfig.org/))

branches/tmp/src/etc/check-sanitycheck.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import os
1414
import sys
1515
import functools
16-
import resource
1716

1817
STATUS = 0
1918

@@ -37,6 +36,7 @@ def inner():
3736

3837
@only_on(('linux', 'darwin', 'freebsd', 'openbsd'))
3938
def check_rlimit_core():
39+
import resource
4040
soft, hard = resource.getrlimit(resource.RLIMIT_CORE)
4141
if soft > 0:
4242
error_unless_permitted('ALLOW_NONZERO_RLIMIT_CORE', """\

branches/tmp/src/libcollections/bit.rs

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,6 +1796,89 @@ impl BitSet {
17961796
self.other_op(other, |w1, w2| w1 ^ w2);
17971797
}
17981798

1799+
/// Moves all elements from `other` into `Self`, leaving `other` empty.
1800+
///
1801+
/// # Examples
1802+
///
1803+
/// ```
1804+
/// # #![feature(collections, bit_set_append_split_off)]
1805+
/// use std::collections::{BitVec, BitSet};
1806+
///
1807+
/// let mut a = BitSet::new();
1808+
/// a.insert(2);
1809+
/// a.insert(6);
1810+
///
1811+
/// let mut b = BitSet::new();
1812+
/// b.insert(1);
1813+
/// b.insert(3);
1814+
/// b.insert(6);
1815+
///
1816+
/// a.append(&mut b);
1817+
///
1818+
/// assert_eq!(a.len(), 4);
1819+
/// assert_eq!(b.len(), 0);
1820+
/// assert_eq!(a, BitSet::from_bit_vec(BitVec::from_bytes(&[0b01110010])));
1821+
/// ```
1822+
#[unstable(feature = "bit_set_append_split_off",
1823+
reason = "recently added as part of collections reform 2")]
1824+
pub fn append(&mut self, other: &mut Self) {
1825+
self.union_with(other);
1826+
other.clear();
1827+
}
1828+
1829+
/// Splits the `BitSet` into two at the given key including the key.
1830+
/// Retains the first part in-place while returning the second part.
1831+
///
1832+
/// # Examples
1833+
///
1834+
/// ```
1835+
/// # #![feature(collections, bit_set_append_split_off)]
1836+
/// use std::collections::{BitSet, BitVec};
1837+
/// let mut a = BitSet::new();
1838+
/// a.insert(2);
1839+
/// a.insert(6);
1840+
/// a.insert(1);
1841+
/// a.insert(3);
1842+
///
1843+
/// let b = a.split_off(3);
1844+
///
1845+
/// assert_eq!(a.len(), 2);
1846+
/// assert_eq!(b.len(), 2);
1847+
/// assert_eq!(a, BitSet::from_bit_vec(BitVec::from_bytes(&[0b01100000])));
1848+
/// assert_eq!(b, BitSet::from_bit_vec(BitVec::from_bytes(&[0b00010010])));
1849+
/// ```
1850+
#[unstable(feature = "bit_set_append_split_off",
1851+
reason = "recently added as part of collections reform 2")]
1852+
pub fn split_off(&mut self, at: usize) -> Self {
1853+
let mut other = BitSet::new();
1854+
1855+
if at == 0 {
1856+
swap(self, &mut other);
1857+
return other;
1858+
} else if at >= self.bit_vec.len() {
1859+
return other;
1860+
}
1861+
1862+
// Calculate block and bit at which to split
1863+
let w = at / u32::BITS;
1864+
let b = at % u32::BITS;
1865+
1866+
// Pad `other` with `w` zero blocks,
1867+
// append `self`'s blocks in the range from `w` to the end to `other`
1868+
other.bit_vec.storage.extend(repeat(0u32).take(w)
1869+
.chain(self.bit_vec.storage[w..].iter().cloned()));
1870+
other.bit_vec.nbits = self.bit_vec.nbits;
1871+
1872+
if b > 0 {
1873+
other.bit_vec.storage[w] &= !0 << b;
1874+
}
1875+
1876+
// Sets `bit_vec.len()` and fixes the last block as well
1877+
self.bit_vec.truncate(at);
1878+
1879+
other
1880+
}
1881+
17991882
/// Returns the number of set bits in this set.
18001883
#[inline]
18011884
#[stable(feature = "rust1", since = "1.0.0")]

branches/tmp/src/libcollections/slice.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ pub trait SliceConcatExt<T: ?Sized> {
10021002
/// The resulting type after concatenation
10031003
type Output;
10041004

1005-
/// Flattens a slice of `T` into a single value `U`.
1005+
/// Flattens a slice of `T` into a single value `Self::Output`.
10061006
///
10071007
/// # Examples
10081008
///
@@ -1012,7 +1012,8 @@ pub trait SliceConcatExt<T: ?Sized> {
10121012
#[stable(feature = "rust1", since = "1.0.0")]
10131013
fn concat(&self) -> Self::Output;
10141014

1015-
/// Flattens a slice of `T` into a single value `U`, placing a given separator between each.
1015+
/// Flattens a slice of `T` into a single value `Self::Output`, placing a given separator
1016+
/// between each.
10161017
///
10171018
/// # Examples
10181019
///

branches/tmp/src/libcollections/string.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,7 @@ impl<T: fmt::Display + ?Sized> ToString for T {
10521052

10531053
#[stable(feature = "rust1", since = "1.0.0")]
10541054
impl AsRef<str> for String {
1055+
#[inline]
10551056
fn as_ref(&self) -> &str {
10561057
self
10571058
}

0 commit comments

Comments
 (0)