Skip to content

Commit c846dba

Browse files
committed
---
yaml --- r: 210172 b: refs/heads/try c: e50df77 h: refs/heads/master v: v3
1 parent a229475 commit c846dba

Some content is hidden

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

54 files changed

+394
-789
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 3e561f05c00cd180ec02db4ccab2840a4aba93d2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ba0e1cd8147d452c356aacb29fb87568ca26f111
5-
refs/heads/try: 42fbcf3525b23879395bbb9ac7ef66310d118c4a
5+
refs/heads/try: e50df770ccca67d2f66369953e14bf6cdb98418a
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ fi
544544
BOOL_OPTIONS=""
545545
VAL_OPTIONS=""
546546

547-
opt debug 0 "debug mode; disables optimization unless \`--enable-optimize\` given"
547+
opt debug 0 "debug mode"
548548
opt valgrind 0 "run tests with valgrind (memcheck by default)"
549549
opt helgrind 0 "run tests with helgrind instead of memcheck"
550550
opt valgrind-rpass 1 "run rpass-valgrind tests with valgrind"

branches/try/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/try/src/doc/reference.md

Lines changed: 7 additions & 1 deletion
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
```

branches/try/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/try/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/try/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/try/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/try/src/librustc/diagnostics.rs

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,6 @@ match x {
168168
```
169169
"##,
170170

171-
E0010: r##"
172-
The value of statics and constants must be known at compile time, and they live
173-
for the entire lifetime of a program. Creating a boxed value allocates memory on
174-
the heap at runtime, and therefore cannot be done at compile time.
175-
"##,
176-
177171
E0013: r##"
178172
Static and const variables can refer to other const variables. But a const
179173
variable cannot refer to a static variable. For example, `Y` cannot refer to `X`
@@ -227,31 +221,6 @@ This error indicates that an attempt was made to divide by zero (or take the
227221
remainder of a zero divisor) in a static or constant expression.
228222
"##,
229223

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-
255224
E0133: r##"
256225
Using unsafe functionality, such as dereferencing raw pointers and calling
257226
functions via FFI or marked as unsafe, is potentially dangerous and disallowed
@@ -525,13 +494,16 @@ a compile-time constant.
525494
}
526495

527496
register_diagnostics! {
497+
E0010,
528498
E0011,
529499
E0012,
530500
E0014,
531501
E0016,
532502
E0017,
533503
E0019,
534504
E0022,
505+
E0079, // enum variant: expected signed integer constant
506+
E0080, // enum variant: constant evaluation error
535507
E0109,
536508
E0110,
537509
E0134,

branches/try/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/try/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);

branches/try/src/librustc/metadata/encoder.rs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ struct entry<T> {
103103

104104
fn encode_trait_ref<'a, 'tcx>(rbml_w: &mut Encoder,
105105
ecx: &EncodeContext<'a, 'tcx>,
106-
trait_ref: ty::TraitRef<'tcx>,
106+
trait_ref: &ty::TraitRef<'tcx>,
107107
tag: usize) {
108108
let ty_str_ctxt = &tyencode::ctxt {
109109
diag: ecx.diag,
@@ -191,7 +191,7 @@ pub fn write_trait_ref<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
191191
tcx: ecx.tcx,
192192
abbrevs: &ecx.type_abbrevs
193193
};
194-
tyencode::enc_trait_ref(rbml_w, ty_str_ctxt, *trait_ref);
194+
tyencode::enc_trait_ref(rbml_w, ty_str_ctxt, trait_ref);
195195
}
196196

197197
pub fn write_region(ecx: &EncodeContext,
@@ -974,14 +974,16 @@ fn encode_inherent_implementations(ecx: &EncodeContext,
974974
fn encode_extension_implementations(ecx: &EncodeContext,
975975
rbml_w: &mut Encoder,
976976
trait_def_id: DefId) {
977-
assert!(ast_util::is_local(trait_def_id));
978-
let def = ty::lookup_trait_def(ecx.tcx, trait_def_id);
979-
980-
def.for_each_impl(ecx.tcx, |impl_def_id| {
981-
rbml_w.start_tag(tag_items_data_item_extension_impl);
982-
encode_def_id(rbml_w, impl_def_id);
983-
rbml_w.end_tag();
984-
});
977+
match ecx.tcx.trait_impls.borrow().get(&trait_def_id) {
978+
None => {}
979+
Some(implementations) => {
980+
for &impl_def_id in &*implementations.borrow() {
981+
rbml_w.start_tag(tag_items_data_item_extension_impl);
982+
encode_def_id(rbml_w, impl_def_id);
983+
rbml_w.end_tag();
984+
}
985+
}
986+
}
985987
}
986988

987989
fn encode_stability(rbml_w: &mut Encoder, stab_opt: Option<attr::Stability>) {
@@ -1199,7 +1201,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
11991201
encode_unsafety(rbml_w, unsafety);
12001202

12011203
let trait_ref = ty::impl_id_to_trait_ref(tcx, item.id);
1202-
encode_trait_ref(rbml_w, ecx, trait_ref, tag_item_trait_ref);
1204+
encode_trait_ref(rbml_w, ecx, &*trait_ref, tag_item_trait_ref);
12031205
rbml_w.end_tag();
12041206
}
12051207
ast::ItemImpl(unsafety, polarity, _, ref opt_trait, ref ty, ref ast_items) => {
@@ -1244,7 +1246,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
12441246
}
12451247
if opt_trait.is_some() {
12461248
let trait_ref = ty::impl_id_to_trait_ref(tcx, item.id);
1247-
encode_trait_ref(rbml_w, ecx, trait_ref, tag_item_trait_ref);
1249+
encode_trait_ref(rbml_w, ecx, &*trait_ref, tag_item_trait_ref);
12481250
}
12491251
encode_path(rbml_w, path.clone());
12501252
encode_stability(rbml_w, stab);
@@ -1312,7 +1314,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
13121314
tag_item_generics);
13131315
encode_predicates(rbml_w, ecx, &ty::lookup_super_predicates(tcx, def_id),
13141316
tag_item_super_predicates);
1315-
encode_trait_ref(rbml_w, ecx, trait_def.trait_ref, tag_item_trait_ref);
1317+
encode_trait_ref(rbml_w, ecx, &*trait_def.trait_ref, tag_item_trait_ref);
13161318
encode_name(rbml_w, item.ident.name);
13171319
encode_attributes(rbml_w, &item.attrs);
13181320
encode_visibility(rbml_w, vis);

branches/try/src/librustc/metadata/tydecode.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use middle::subst;
2323
use middle::subst::VecPerParamSpace;
2424
use middle::ty::{self, AsPredicate, Ty};
2525

26+
use std::rc::Rc;
2627
use std::str;
2728
use syntax::abi;
2829
use syntax::ast;
@@ -181,7 +182,7 @@ pub fn parse_bare_fn_ty_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum, pos
181182

182183
pub fn parse_trait_ref_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum, pos: usize,
183184
tcx: &ty::ctxt<'tcx>, conv: F)
184-
-> ty::TraitRef<'tcx> where
185+
-> Rc<ty::TraitRef<'tcx>> where
185186
F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
186187
{
187188
debug!("parse_trait_ref_data {}", data_log_string(data, pos));
@@ -433,19 +434,19 @@ fn parse_str(st: &mut PState, term: char) -> String {
433434
}
434435

435436
fn parse_trait_ref<'a, 'tcx, F>(st: &mut PState<'a, 'tcx>, mut conv: F)
436-
-> ty::TraitRef<'tcx> where
437+
-> Rc<ty::TraitRef<'tcx>> where
437438
F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
438439
{
439440
parse_trait_ref_(st, &mut conv)
440441
}
441442

442443
fn parse_trait_ref_<'a, 'tcx, F>(st: &mut PState<'a, 'tcx>, conv: &mut F)
443-
-> ty::TraitRef<'tcx> where
444+
-> Rc<ty::TraitRef<'tcx>> where
444445
F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
445446
{
446447
let def = parse_def_(st, NominalType, conv);
447448
let substs = st.tcx.mk_substs(parse_substs_(st, conv));
448-
ty::TraitRef {def_id: def, substs: substs}
449+
Rc::new(ty::TraitRef {def_id: def, substs: substs})
449450
}
450451

451452
fn parse_ty<'a, 'tcx, F>(st: &mut PState<'a, 'tcx>, mut conv: F) -> Ty<'tcx> where

0 commit comments

Comments
 (0)