Skip to content

Commit 82c4f06

Browse files
committed
---
yaml --- r: 216487 b: refs/heads/stable c: 1e40360 h: refs/heads/master i: 216485: c7ae51b 216483: 03e2345 216479: f64bec8 v: v3
1 parent a746825 commit 82c4f06

Some content is hidden

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

64 files changed

+421
-815
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: 4aab003b60943885e340567a6d9cb4bc652614b8
32+
refs/heads/stable: 1e40360af9267abcccee6b465f685c4d43e47534
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375

branches/stable/src/doc/grammar.md

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,9 @@ excluded from the `ident` rule.
176176

177177
```antlr
178178
lit_suffix : ident;
179-
literal : [ string_lit | char_lit | byte_string_lit | byte_lit | num_lit | bool_lit ] lit_suffix ?;
179+
literal : [ string_lit | char_lit | byte_string_lit | byte_lit | num_lit ] lit_suffix ?;
180180
```
181181

182-
The optional `lit_suffix` production is only used for certain numeric literals,
183-
but is reserved for future extension. That is, the above gives the lexical
184-
grammar, but a Rust parser will reject everything but the 12 special cases
185-
mentioned in [Number literals](reference.html#number-literals) in the
186-
reference.
187-
188182
#### Character and string literals
189183

190184
```antlr
@@ -244,9 +238,7 @@ dec_lit : [ dec_digit | '_' ] + ;
244238

245239
#### Boolean literals
246240

247-
```antlr
248-
bool_lit : [ "true" | "false" ] ;
249-
```
241+
**FIXME:** write grammar
250242

251243
The two values of the boolean type are written `true` and `false`.
252244

@@ -305,7 +297,7 @@ transcriber : '(' transcriber * ')' | '[' transcriber * ']'
305297

306298
```antlr
307299
item : mod_item | fn_item | type_item | struct_item | enum_item
308-
| const_item | static_item | trait_item | impl_item | extern_block ;
300+
| static_item | trait_item | impl_item | extern_block ;
309301
```
310302

311303
### Type Parameters
@@ -377,10 +369,6 @@ path_item : ident | "mod" ;
377369

378370
**FIXME:** grammar?
379371

380-
### Enumerations
381-
382-
**FIXME:** grammar?
383-
384372
### Constant items
385373

386374
```antlr

branches/stable/src/doc/reference.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ of tokens, that immediately and directly denotes the value it evaluates to,
130130
rather than referring to it by name or some other evaluation rule. A literal is
131131
a form of constant expression, so is evaluated (primarily) at compile time.
132132

133+
The optional suffix is only used for certain numeric literals, but is
134+
reserved for future extension, that is, the above gives the lexical
135+
grammar, but a Rust parser will reject everything but the 12 special
136+
cases mentioned in [Number literals](#number-literals) below.
137+
133138
#### Examples
134139

135140
##### Characters and strings
@@ -1557,7 +1562,8 @@ warnings are generated, or otherwise "you used a private item of another module
15571562
and weren't allowed to."
15581563

15591564
By default, everything in Rust is *private*, with one exception. Enum variants
1560-
in a `pub` enum are also public by default. When an item is declared as `pub`,
1565+
in a `pub` enum are also public by default. You are allowed to alter this
1566+
default visibility with the `priv` keyword. When an item is declared as `pub`,
15611567
it can be thought of as being accessible to the outside world. For example:
15621568

15631569
```
@@ -2425,18 +2431,11 @@ Tuples are written by enclosing zero or more comma-separated expressions in
24252431
parentheses. They are used to create [tuple-typed](#tuple-types) values.
24262432

24272433
```{.tuple}
2434+
(0,);
24282435
(0.0, 4.5);
24292436
("a", 4usize, true);
24302437
```
24312438

2432-
You can disambiguate a single-element tuple from a value in parentheses with a
2433-
comma:
2434-
2435-
```
2436-
(0,); // single-element tuple
2437-
(0); // zero in parentheses
2438-
```
2439-
24402439
### Unit expressions
24412440

24422441
The expression `()` denotes the _unit value_, the only value of the type with

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,4 @@ Rust attributes are used for a number of different things. There is a full list
6767
of attributes [in the reference][reference]. Currently, you are not allowed to
6868
create your own attributes, the Rust compiler defines them.
6969

70-
[reference]: ../reference.html#attributes
70+
[reference]: reference.html#attributes

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,18 @@ this reason.
1919
# `static`
2020

2121
Rust provides a ‘global variable’ sort of facility in static items. They’re
22-
similar to constants, but static items aren’t inlined upon use. This means that
23-
there is only one instance for each value, and it’s at a fixed location in
24-
memory.
22+
similar to [constants][const], but static items aren’t inlined upon use. This
23+
means that there is only one instance for each value, and it’s at a fixed
24+
location in memory.
2525

2626
Here’s an example:
2727

2828
```rust
2929
static N: i32 = 5;
3030
```
3131

32+
[const]: const.html
33+
3234
Unlike [`let`][let] bindings, you must annotate the type of a `static`.
3335

3436
[let]: variable-bindings.html

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,26 @@ Ranges are one of two basic iterators that you'll see. The other is `iter()`.
235235
in turn:
236236

237237
```rust
238-
let nums = vec![1, 2, 3];
238+
let nums = [1, 2, 3];
239239

240240
for num in nums.iter() {
241241
println!("{}", num);
242242
}
243243
```
244244

245245
These two basic iterators should serve you well. There are some more
246-
advanced iterators, including ones that are infinite.
246+
advanced iterators, including ones that are infinite. Like using range syntax
247+
and `step_by`:
248+
249+
```rust
250+
# #![feature(step_by)]
251+
(1..).step_by(5);
252+
```
253+
254+
This iterator counts up from one, adding five each time. It will give
255+
you a new integer every time, forever (well, technically, until it reaches the
256+
maximum number representable by an `i32`). But since iterators are lazy,
257+
that's okay! You probably don't want to use `collect()` on it, though...
247258

248259
That's enough about iterators. Iterator adapters are the last concept
249260
we need to talk about with regards to iterators. Let's get to it!

branches/stable/src/doc/trpl/nightly-rust.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ If not, there are a number of places where you can get help. The easiest is
9393
[the #rust IRC channel on irc.mozilla.org][irc], which you can access through
9494
[Mibbit][mibbit]. Click that link, and you'll be chatting with other Rustaceans
9595
(a silly nickname we call ourselves), and we can help you out. Other great
96-
resources include [the user’s forum][users], and [Stack Overflow][stack overflow].
96+
resources include [the user’s forum][users], and [Stack Overflow][stack
97+
overflow].
9798

9899
[irc]: irc://irc.mozilla.org/#rust
99100
[mibbit]: http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -248,14 +248,6 @@ or “breaks up” the tuple, and assigns the bits to three bindings.
248248

249249
This pattern is very powerful, and we’ll see it repeated more later.
250250

251-
You can disambiguate a single-element tuple from a value in parentheses with a
252-
comma:
253-
254-
```
255-
(0,); // single-element tuple
256-
(0); // zero in parentheses
257-
```
258-
259251
## Tuple Indexing
260252

261253
You can also access fields of a tuple with indexing syntax:

branches/stable/src/doc/trpl/raw-pointers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Raw pointers are useful for FFI: Rust’s `*const T` and `*mut T` are similar to
8080
C’s `const T*` and `T*`, respectfully. For more about this use, consult the
8181
[FFI chapter][ffi].
8282

83-
[ffi]: ffi.html
83+
[ffi]: ffi.md
8484

8585
# References and raw pointers
8686

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Rust has a feature called ‘`static mut`’ which allows for mutable global sta
101101
Doing so can cause a data race, and as such is inherently not safe. For more
102102
details, see the [static][static] section of the book.
103103

104-
[static]: const-and-static.html#static
104+
[static]: static.html
105105

106106
## Dereference a raw pointer
107107

branches/stable/src/doc/trpl/unsized-types.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,9 @@ impl Foo for &str {
3838
```
3939

4040
Meaning, this implementation would only work for [references][ref], and not
41-
other types of pointers. With the `impl for str`, all pointers, including (at
42-
some point, there are some bugs to fix first) user-defined custom smart
43-
pointers, can use this `impl`.
44-
45-
[ref]: references-and-borrowing.html
41+
other types of pointers. With this `impl`, all pointers, including (at some
42+
point, there are some bugs to fix first) user-defined custom smart pointers,
43+
can use this `impl`.
4644

4745
# ?Sized
4846

branches/stable/src/liballoc/boxed.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,6 @@ impl<T: ?Sized + Hash> Hash for Box<T> {
240240
impl Box<Any> {
241241
#[inline]
242242
#[stable(feature = "rust1", since = "1.0.0")]
243-
/// Attempt to downcast the box to a concrete type.
244243
pub fn downcast<T: Any>(self) -> Result<Box<T>, Box<Any>> {
245244
if self.is::<T>() {
246245
unsafe {
@@ -258,15 +257,11 @@ impl Box<Any> {
258257
}
259258
}
260259

261-
impl Box<Any + Send> {
260+
impl Box<Any+Send> {
262261
#[inline]
263262
#[stable(feature = "rust1", since = "1.0.0")]
264-
/// Attempt to downcast the box to a concrete type.
265-
pub fn downcast<T: Any>(self) -> Result<Box<T>, Box<Any + Send>> {
266-
<Box<Any>>::downcast(self).map_err(|s| unsafe {
267-
// reapply the Send marker
268-
mem::transmute::<Box<Any>, Box<Any + Send>>(s)
269-
})
263+
pub fn downcast<T: Any>(self) -> Result<Box<T>, Box<Any>> {
264+
<Box<Any>>::downcast(self)
270265
}
271266
}
272267

branches/stable/src/libcollections/fmt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@
398398
//! longer than this width, then it is truncated down to this many characters and only those are
399399
//! emitted.
400400
//!
401-
//! For integral types, this has no meaning currently.
401+
//! For integral types, this is ignored.
402402
//!
403403
//! For floating-point types, this indicates how many digits after the decimal point should be
404404
//! printed.

branches/stable/src/libcore/any.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ pub trait Any: Reflect + 'static {
9797
fn get_type_id(&self) -> TypeId;
9898
}
9999

100-
impl<T: Reflect + 'static> Any for T {
100+
impl<T> Any for T
101+
where T: Reflect + 'static
102+
{
101103
fn get_type_id(&self) -> TypeId { TypeId::of::<T>() }
102104
}
103105

@@ -220,7 +222,7 @@ impl TypeId {
220222
/// Returns the `TypeId` of the type this generic function has been
221223
/// instantiated with
222224
#[stable(feature = "rust1", since = "1.0.0")]
223-
pub fn of<T: ?Sized + Reflect + 'static>() -> TypeId {
225+
pub fn of<T: ?Sized + Any>() -> TypeId {
224226
TypeId {
225227
t: unsafe { intrinsics::type_id::<T>() },
226228
}

branches/stable/src/libcore/marker.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,6 @@ mod impls {
416416
#[rustc_reflect_like]
417417
#[unstable(feature = "core", reason = "requires RFC and more experience")]
418418
#[allow(deprecated)]
419-
#[rustc_on_unimplemented = "`{Self}` does not implement `Any`; \
420-
ensure all type parameters are bounded by `Any`"]
421419
pub trait Reflect {}
422420

423421
impl Reflect for .. { }

branches/stable/src/librustc/diagnostics.rs

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -227,31 +227,6 @@ This error indicates that an attempt was made to divide by zero (or take the
227227
remainder of a zero divisor) in a static or constant expression.
228228
"##,
229229

230-
E0079: r##"
231-
Enum variants which contain no data can be given a custom integer
232-
representation. This error indicates that the value provided is not an
233-
integer literal and is therefore invalid.
234-
"##,
235-
236-
E0080: r##"
237-
This error indicates that the compiler was unable to sensibly evaluate an
238-
integer expression provided as an enum discriminant. Attempting to divide by 0
239-
or causing integer overflow are two ways to induce this error. For example:
240-
241-
```
242-
enum Enum {
243-
X = (1 << 500),
244-
Y = (1 / 0)
245-
}
246-
```
247-
248-
Ensure that the expressions given can be evaluated as the desired integer type.
249-
See the FFI section of the Reference for more information about using a custom
250-
integer type:
251-
252-
http://doc.rust-lang.org/reference.html#ffi-attributes
253-
"##,
254-
255230
E0133: r##"
256231
Using unsafe functionality, such as dereferencing raw pointers and calling
257232
functions via FFI or marked as unsafe, is potentially dangerous and disallowed
@@ -532,6 +507,8 @@ register_diagnostics! {
532507
E0017,
533508
E0019,
534509
E0022,
510+
E0079, // enum variant: expected signed integer constant
511+
E0080, // enum variant: constant evaluation error
535512
E0109,
536513
E0110,
537514
E0134,

branches/stable/src/librustc/metadata/csearch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ pub fn get_impl_polarity<'tcx>(tcx: &ty::ctxt<'tcx>,
283283
// if there is one.
284284
pub fn get_impl_trait<'tcx>(tcx: &ty::ctxt<'tcx>,
285285
def: ast::DefId)
286-
-> Option<ty::TraitRef<'tcx>> {
286+
-> Option<Rc<ty::TraitRef<'tcx>>> {
287287
let cstore = &tcx.sess.cstore;
288288
let cdata = cstore.get_crate_data(def.krate);
289289
decoder::get_impl_trait(&*cdata, def.node, tcx)

branches/stable/src/librustc/metadata/decoder.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ use middle::subst;
3030
use middle::ty::{ImplContainer, TraitContainer};
3131
use middle::ty::{self, Ty};
3232
use middle::astencode::vtable_decoder_helpers;
33-
use util::nodemap::FnvHashMap;
3433

35-
use std::cell::{Cell, RefCell};
3634
use std::collections::HashMap;
3735
use std::hash::{self, Hash, SipHasher};
3836
use std::io::prelude::*;
@@ -249,13 +247,13 @@ pub fn item_type<'tcx>(_item_id: ast::DefId, item: rbml::Doc,
249247
}
250248

251249
fn doc_trait_ref<'tcx>(doc: rbml::Doc, tcx: &ty::ctxt<'tcx>, cdata: Cmd)
252-
-> ty::TraitRef<'tcx> {
250+
-> Rc<ty::TraitRef<'tcx>> {
253251
parse_trait_ref_data(doc.data, cdata.cnum, doc.start, tcx,
254252
|_, did| translate_def_id(cdata, did))
255253
}
256254

257255
fn item_trait_ref<'tcx>(doc: rbml::Doc, tcx: &ty::ctxt<'tcx>, cdata: Cmd)
258-
-> ty::TraitRef<'tcx> {
256+
-> Rc<ty::TraitRef<'tcx>> {
259257
let tp = reader::get_doc(doc, tag_item_trait_ref);
260258
doc_trait_ref(tp, tcx, cdata)
261259
}
@@ -422,9 +420,6 @@ pub fn get_trait_def<'tcx>(cdata: Cmd,
422420
generics: generics,
423421
trait_ref: item_trait_ref(item_doc, tcx, cdata),
424422
associated_type_names: associated_type_names,
425-
nonblanket_impls: RefCell::new(FnvHashMap()),
426-
blanket_impls: RefCell::new(vec![]),
427-
flags: Cell::new(ty::TraitFlags::NO_TRAIT_FLAGS)
428423
}
429424
}
430425

@@ -495,7 +490,7 @@ pub fn get_impl_polarity<'tcx>(cdata: Cmd,
495490
pub fn get_impl_trait<'tcx>(cdata: Cmd,
496491
id: ast::NodeId,
497492
tcx: &ty::ctxt<'tcx>)
498-
-> Option<ty::TraitRef<'tcx>>
493+
-> Option<Rc<ty::TraitRef<'tcx>>>
499494
{
500495
let item_doc = lookup_item(id, cdata.data());
501496
let fam = item_family(item_doc);

0 commit comments

Comments
 (0)