Skip to content

Commit 7e6822d

Browse files
committed
---
yaml --- r: 210175 b: refs/heads/try c: 84a23be h: refs/heads/master i: 210173: ab4a9b7 210171: a229475 210167: bce8feb 210159: 69fd5c8 210143: 479e9f4 210111: 7bc9655 210047: 9d589f9 209919: b25de6b v: v3
1 parent 3f3040e commit 7e6822d

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

+820
-398
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: 27bcd2ebc75b45b3c1afc6cc67ce652b7fdca2e6
5+
refs/heads/try: 84a23be53751158dc88a7ce399ea5555cf3ea833
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"
547+
opt debug 0 "debug mode; disables optimization unless \`--enable-optimize\` given"
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: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,15 @@ 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 ] lit_suffix ?;
179+
literal : [ string_lit | char_lit | byte_string_lit | byte_lit | num_lit | bool_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+
182188
#### Character and string literals
183189

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

239245
#### Boolean literals
240246

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

243251
The two values of the boolean type are written `true` and `false`.
244252

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

298306
```antlr
299307
item : mod_item | fn_item | type_item | struct_item | enum_item
300-
| static_item | trait_item | impl_item | extern_block ;
308+
| const_item | static_item | trait_item | impl_item | extern_block ;
301309
```
302310

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

370378
**FIXME:** grammar?
371379

380+
### Enumerations
381+
382+
**FIXME:** grammar?
383+
372384
### Constant items
373385

374386
```antlr

branches/try/src/doc/reference.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,6 @@ 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-
138133
#### Examples
139134

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

15641559
By default, everything in Rust is *private*, with one exception. Enum variants
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`,
1560+
in a `pub` enum are also public by default. When an item is declared as `pub`,
15671561
it can be thought of as being accessible to the outside world. For example:
15681562

15691563
```

branches/try/src/doc/trpl/inline-assembly.md

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ but you must add the right number of `:` if you skip them:
5858
asm!("xor %eax, %eax"
5959
:
6060
:
61-
: "eax"
61+
: "{eax}"
6262
);
6363
# } }
6464
```
@@ -69,21 +69,21 @@ Whitespace also doesn't matter:
6969
# #![feature(asm)]
7070
# #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
7171
# fn main() { unsafe {
72-
asm!("xor %eax, %eax" ::: "eax");
72+
asm!("xor %eax, %eax" ::: "{eax}");
7373
# } }
7474
```
7575

7676
## Operands
7777

7878
Input and output operands follow the same format: `:
7979
"constraints1"(expr1), "constraints2"(expr2), ..."`. Output operand
80-
expressions must be mutable lvalues:
80+
expressions must be mutable lvalues, or not yet assigned:
8181

8282
```
8383
# #![feature(asm)]
8484
# #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
8585
fn add(a: i32, b: i32) -> i32 {
86-
let mut c = 0;
86+
let c: i32;
8787
unsafe {
8888
asm!("add $2, $0"
8989
: "=r"(c)
@@ -100,6 +100,22 @@ fn main() {
100100
}
101101
```
102102

103+
If you would like to use real operands in this position, however,
104+
you are required to put curly braces `{}` around the register that
105+
you want, and you are required to put the specific size of the
106+
operand. This is useful for very low level programming, where
107+
which register you use is important:
108+
109+
```
110+
# #![feature(asm)]
111+
# #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
112+
# unsafe fn read_byte_in(port: u16) -> u8 {
113+
let result: u8;
114+
asm!("in %dx, %al" : "={al}"(result) : "{dx}"(port));
115+
result
116+
# }
117+
```
118+
103119
## Clobbers
104120

105121
Some instructions modify registers which might otherwise have held
@@ -112,7 +128,7 @@ stay valid.
112128
# #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
113129
# fn main() { unsafe {
114130
// Put the value 0x200 in eax
115-
asm!("mov $$0x200, %eax" : /* no outputs */ : /* no inputs */ : "eax");
131+
asm!("mov $$0x200, %eax" : /* no outputs */ : /* no inputs */ : "{eax}");
116132
# } }
117133
```
118134

@@ -139,3 +155,14 @@ Current valid options are:
139155
the compiler to insert its usual stack alignment code
140156
3. *intel* - use intel syntax instead of the default AT&T.
141157

158+
```
159+
# #![feature(asm)]
160+
# #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
161+
# fn main() {
162+
let result: i32;
163+
unsafe {
164+
asm!("mov eax, 2" : "={eax}"(result) : : : "intel")
165+
}
166+
println!("eax is currently {}", result);
167+
# }
168+
```

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ 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
97-
overflow].
96+
resources include [the user’s forum][users], and [Stack Overflow][stack overflow].
9897

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

branches/try/src/liballoc/boxed.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ 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.
243244
pub fn downcast<T: Any>(self) -> Result<Box<T>, Box<Any>> {
244245
if self.is::<T>() {
245246
unsafe {
@@ -257,11 +258,15 @@ impl Box<Any> {
257258
}
258259
}
259260

260-
impl Box<Any+Send> {
261+
impl Box<Any + Send> {
261262
#[inline]
262263
#[stable(feature = "rust1", since = "1.0.0")]
263-
pub fn downcast<T: Any>(self) -> Result<Box<T>, Box<Any>> {
264-
<Box<Any>>::downcast(self)
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+
})
265270
}
266271
}
267272

branches/try/src/libcore/any.rs

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

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

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

branches/try/src/libcore/marker.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,8 @@ 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`"]
419421
pub trait Reflect {}
420422

421423
impl Reflect for .. { }

branches/try/src/librustc/diagnostics.rs

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@ 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+
171177
E0013: r##"
172178
Static and const variables can refer to other const variables. But a const
173179
variable cannot refer to a static variable. For example, `Y` cannot refer to `X`
@@ -221,6 +227,31 @@ This error indicates that an attempt was made to divide by zero (or take the
221227
remainder of a zero divisor) in a static or constant expression.
222228
"##,
223229

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

496527
register_diagnostics! {
497-
E0010,
498528
E0011,
499529
E0012,
500530
E0014,
501531
E0016,
502532
E0017,
503533
E0019,
504534
E0022,
505-
E0079, // enum variant: expected signed integer constant
506-
E0080, // enum variant: constant evaluation error
507535
E0109,
508536
E0110,
509537
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<Rc<ty::TraitRef<'tcx>>> {
286+
-> Option<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: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ 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;
3334

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

249251
fn doc_trait_ref<'tcx>(doc: rbml::Doc, tcx: &ty::ctxt<'tcx>, cdata: Cmd)
250-
-> Rc<ty::TraitRef<'tcx>> {
252+
-> ty::TraitRef<'tcx> {
251253
parse_trait_ref_data(doc.data, cdata.cnum, doc.start, tcx,
252254
|_, did| translate_def_id(cdata, did))
253255
}
254256

255257
fn item_trait_ref<'tcx>(doc: rbml::Doc, tcx: &ty::ctxt<'tcx>, cdata: Cmd)
256-
-> Rc<ty::TraitRef<'tcx>> {
258+
-> ty::TraitRef<'tcx> {
257259
let tp = reader::get_doc(doc, tag_item_trait_ref);
258260
doc_trait_ref(tp, tcx, cdata)
259261
}
@@ -420,6 +422,9 @@ pub fn get_trait_def<'tcx>(cdata: Cmd,
420422
generics: generics,
421423
trait_ref: item_trait_ref(item_doc, tcx, cdata),
422424
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)
423428
}
424429
}
425430

@@ -490,7 +495,7 @@ pub fn get_impl_polarity<'tcx>(cdata: Cmd,
490495
pub fn get_impl_trait<'tcx>(cdata: Cmd,
491496
id: ast::NodeId,
492497
tcx: &ty::ctxt<'tcx>)
493-
-> Option<Rc<ty::TraitRef<'tcx>>>
498+
-> Option<ty::TraitRef<'tcx>>
494499
{
495500
let item_doc = lookup_item(id, cdata.data());
496501
let fam = item_family(item_doc);

0 commit comments

Comments
 (0)