Skip to content

Commit a3a8010

Browse files
committed
---
yaml --- r: 216315 b: refs/heads/stable c: da2276e h: refs/heads/master i: 216313: 9afa3f1 216311: 7080c73 v: v3
1 parent 4e89a95 commit a3a8010

File tree

123 files changed

+3570
-955
lines changed

Some content is hidden

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

123 files changed

+3570
-955
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ refs/heads/tmp: 378a370ff2057afeb1eae86eb6e78c476866a4a6
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: a5286998df566e736b32f6795bfc3803bdaf453d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 142aa0a0ce41f26066ceac5c733909b73f2fc4f9
32+
refs/heads/stable: da2276e293359708b62bb489801cb9872d19d32f
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375

branches/stable/configure

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,9 +659,10 @@ if [ -n "$CFG_ENABLE_DEBUG" ]; then
659659
CFG_DISABLE_OPTIMIZE=1
660660
CFG_DISABLE_OPTIMIZE_CXX=1
661661
fi
662-
CFG_ENABLE_LLVM_ASSERTIONS=1
663662
CFG_ENABLE_DEBUG_ASSERTIONS=1
664663
CFG_ENABLE_DEBUG_JEMALLOC=1
664+
CFG_ENABLE_DEBUGINFO=1
665+
CFG_ENABLE_LLVM_ASSERTIONS=1
665666
fi
666667

667668
# OK, now write the debugging options

branches/stable/src/doc/reference.md

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ that does _not_ occur in the set of [keywords](#keywords).
8484
## Comments
8585

8686
Comments in Rust code follow the general C++ style of line (`//`) and
87-
block-comment (`/* ... */`) forms. Nested block comments are supported.
87+
block (`/* ... */`) comment forms. Nested block comments are supported.
8888

8989
Line comments beginning with exactly _three_ slashes (`///`), and block
9090
comments beginning with exactly one repeated asterisk in the block-open
@@ -192,13 +192,13 @@ which must be _escaped_ by a preceding `U+005C` character (`\`).
192192

193193
A _string literal_ is a sequence of any Unicode characters enclosed within two
194194
`U+0022` (double-quote) characters, with the exception of `U+0022` itself,
195-
which must be _escaped_ by a preceding `U+005C` character (`\`), or a _raw
196-
string literal_.
195+
which must be _escaped_ by a preceding `U+005C` character (`\`).
197196

198-
A multi-line string literal may be defined by terminating each line with a
199-
`U+005C` character (`\`) immediately before the newline. This causes the
200-
`U+005C` character, the newline, and all whitespace at the beginning of the
201-
next line to be ignored.
197+
Line-break characters are allowed in string literals. Normally they represent
198+
themselves (i.e. no translation), but as a special exception, when a `U+005C`
199+
character (`\`) occurs immediately before the newline, the `U+005C` character,
200+
the newline, and all whitespace at the beginning of the next line are ignored.
201+
Thus `a` and `b` are equal:
202202

203203
```rust
204204
let a = "foobar";
@@ -366,11 +366,19 @@ A _floating-point literal_ has one of two forms:
366366
optionally followed by another decimal literal, with an optional _exponent_.
367367
* A single _decimal literal_ followed by an _exponent_.
368368

369-
By default, a floating-point literal has a generic type, and, like integer
370-
literals, the type must be uniquely determined from the context. There are two valid
369+
Like integer literals, a floating-point literal may be followed by a
370+
suffix, so long as the pre-suffix part does not end with `U+002E` (`.`).
371+
The suffix forcibly sets the type of the literal. There are two valid
371372
_floating-point suffixes_, `f32` and `f64` (the 32-bit and 64-bit floating point
372373
types), which explicitly determine the type of the literal.
373374

375+
The type of an _unsuffixed_ floating-point literal is determined by type
376+
inference. If a floating-point type can be _uniquely_ determined from the
377+
surrounding program context, the unsuffixed floating-point literal has that type.
378+
If the program context underconstrains the type, it defaults to double-precision `f64`;
379+
if the program context overconstrains the type, it is considered a static type
380+
error.
381+
374382
Examples of floating-point literals of various forms:
375383

376384
```
@@ -2127,7 +2135,10 @@ The currently implemented features of the reference compiler are:
21272135
semantics are likely to change, so this macro usage must be opted
21282136
into.
21292137

2130-
* `associated_types` - Allows type aliases in traits. Experimental.
2138+
* `associated_consts` - Allows constants to be defined in `impl` and `trait`
2139+
blocks, so that they can be associated with a type or
2140+
trait in a similar manner to methods and associated
2141+
types.
21312142

21322143
* `box_patterns` - Allows `box` patterns, the exact semantics of which
21332144
is subject to change.

branches/stable/src/doc/trpl/const-and-static.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ unsafe {
6666
}
6767
```
6868

69+
[unsafe]: unsafe.html
70+
6971
Furthermore, any type stored in a `static` must be `Sync`.
7072

7173
# Initializing

branches/stable/src/doc/trpl/hello-cargo.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ $ mkdir src
3232
$ mv main.rs src/main.rs
3333
```
3434

35+
Note that since we're creating an executable, we used `main.rs`. If we
36+
want to make a library instead, we should use `lib.rs`.
37+
Custom file locations for the entry point can be specified
38+
with a [`[[lib]]` or `[[bin]]`][crates-custom] key in the TOML file described below.
39+
40+
[crates-custom]: http://doc.crates.io/manifest.html#configuring-a-target
41+
3542
Cargo expects your source files to live inside a `src` directory. That leaves
3643
the top level for other things, like READMEs, license information, and anything
3744
not related to your code. Cargo helps us keep our projects nice and tidy. A

branches/stable/src/doc/trpl/vectors.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
% Vectors
22

33
A ‘vector’ is a dynamic or ‘growable’ array, implemented as the standard
4-
library type [`Vec<T>`][vec]. That `<T>` is a [generic][generic], meaning we
5-
can have vectors of any type. Vectors always allocate their data on the heap.
4+
library type [`Vec<T>`][vec]. The `T` means that we can have vectors
5+
of any type (see the chapter on [generics][generic] for more).
6+
Vectors always allocate their data on the heap.
67
You can create them with the `vec!` macro:
78

89
```rust

branches/stable/src/grammar/parser-lalr.y

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,10 +505,20 @@ trait_items
505505
;
506506

507507
trait_item
508-
: trait_type
508+
: trait_const
509+
| trait_type
509510
| trait_method
510511
;
511512

513+
trait_const
514+
: maybe_outer_attrs CONST ident maybe_const_default ';' { $$ = mk_node("ConstTraitItem", 3, $1, $3, $4); }
515+
;
516+
517+
maybe_const_default
518+
: '=' expr { $$ = mk_node("ConstDefault", 1, $2); }
519+
| %empty { $$ = mk_none(); }
520+
;
521+
512522
trait_type
513523
: maybe_outer_attrs TYPE ty_param ';' { $$ = mk_node("TypeTraitItem", 2, $1, $3); }
514524
;
@@ -611,7 +621,16 @@ impl_items
611621
impl_item
612622
: impl_method
613623
| item_macro
614-
| trait_type
624+
| impl_const
625+
| impl_type
626+
;
627+
628+
impl_const
629+
: attrs_and_vis item_const { $$ = mk_node("ImplConst", 1, $1, $2); }
630+
;
631+
632+
impl_type
633+
: attrs_and_vis TYPE ident generic_params '=' ty_sum ';' { $$ = mk_node("ImplType", 4, $1, $3, $4, $6); }
615634
;
616635

617636
item_fn

branches/stable/src/libcollections/string.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -951,12 +951,13 @@ impl<'a> Deref for DerefString<'a> {
951951
/// # #![feature(collections)]
952952
/// use std::string::as_string;
953953
///
954-
/// fn string_consumer(s: String) {
955-
/// assert_eq!(s, "foo".to_string());
954+
/// // Let's pretend we have a function that requires `&String`
955+
/// fn string_consumer(s: &String) {
956+
/// assert_eq!(s, "foo");
956957
/// }
957958
///
958-
/// let string = as_string("foo").clone();
959-
/// string_consumer(string);
959+
/// // Provide a `&String` from a `&str` without allocating
960+
/// string_consumer(&as_string("foo"));
960961
/// ```
961962
#[unstable(feature = "collections")]
962963
pub fn as_string<'a>(x: &'a str) -> DerefString<'a> {

branches/stable/src/libcollections/vec.rs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,7 @@ static MAX_MEMORY_SIZE: usize = isize::MAX as usize;
116116
/// stack.push(2);
117117
/// stack.push(3);
118118
///
119-
/// loop {
120-
/// let top = match stack.pop() {
121-
/// None => break, // empty
122-
/// Some(x) => x,
123-
/// };
119+
/// while let Some(top) = stack.pop() {
124120
/// // Prints 3, 2, 1
125121
/// println!("{}", top);
126122
/// }
@@ -540,7 +536,7 @@ impl<T> Vec<T> {
540536
///
541537
/// # Panics
542538
///
543-
/// Panics if `i` is out of bounds.
539+
/// Panics if `index` is out of bounds.
544540
///
545541
/// # Examples
546542
///
@@ -1919,6 +1915,22 @@ impl<'a, T> Drop for DerefVec<'a, T> {
19191915
}
19201916

19211917
/// Converts a slice to a wrapper type providing a `&Vec<T>` reference.
1918+
///
1919+
/// # Examples
1920+
///
1921+
/// ```
1922+
/// # #![feature(collections)]
1923+
/// use std::vec::as_vec;
1924+
///
1925+
/// // Let's pretend we have a function that requires `&Vec<i32>`
1926+
/// fn vec_consumer(s: &Vec<i32>) {
1927+
/// assert_eq!(s, &[1, 2, 3]);
1928+
/// }
1929+
///
1930+
/// // Provide a `&Vec<i32>` from a `&[i32]` without allocating
1931+
/// let values = [1, 2, 3];
1932+
/// vec_consumer(&as_vec(&values));
1933+
/// ```
19221934
#[unstable(feature = "collections")]
19231935
pub fn as_vec<'a, T>(x: &'a [T]) -> DerefVec<'a, T> {
19241936
unsafe {

branches/stable/src/libcore/atomic.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,12 @@ pub struct AtomicPtr<T> {
129129
_marker: PhantomData<*mut T>,
130130
}
131131

132+
impl<T> Default for AtomicPtr<T> {
133+
fn default() -> AtomicPtr<T> {
134+
AtomicPtr::new(::ptr::null_mut())
135+
}
136+
}
137+
132138
unsafe impl<T> Sync for AtomicPtr<T> {}
133139

134140
/// Atomic memory orderings

branches/stable/src/libcore/cell.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ impl<T> RefCell<T> {
417417
///
418418
/// let result = thread::spawn(move || {
419419
/// let c = RefCell::new(5);
420-
/// let m = c.borrow_mut();
420+
/// let m = c.borrow();
421421
///
422422
/// let b = c.borrow_mut(); // this causes a panic
423423
/// }).join();

branches/stable/src/libcore/convert.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,8 @@ pub trait Into<T>: Sized {
8383
/// `String` implements `From<&str>`:
8484
///
8585
/// ```
86-
/// let s = "hello";
8786
/// let string = "hello".to_string();
88-
///
89-
/// let other_string: String = From::from(s);
87+
/// let other_string = String::from("hello");
9088
///
9189
/// assert_eq!(string, other_string);
9290
/// ```

branches/stable/src/libcore/iter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ pub trait Iterator {
179179

180180
/// Creates an iterator that iterates over both this and the specified
181181
/// iterators simultaneously, yielding the two elements as pairs. When
182-
/// either iterator returns `None`, all further invocations of next() will
183-
/// return `None`.
182+
/// either iterator returns `None`, all further invocations of `next()`
183+
/// will return `None`.
184184
///
185185
/// # Examples
186186
///

0 commit comments

Comments
 (0)