Skip to content

Commit 25489e7

Browse files
committed
---
yaml --- r: 207870 b: refs/heads/snap-stage3 c: 19717cb h: refs/heads/master v: v3
1 parent 3f48671 commit 25489e7

File tree

9 files changed

+43
-162
lines changed

9 files changed

+43
-162
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 38a97becdf3e6a6157f6f7ec2d98ade8d8edc193
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: e962870420fef19e8f23a299dbe7499aca1656a5
4+
refs/heads/snap-stage3: 19717cbf46ecc9735c0f9ae110638db9445740a5
55
refs/heads/try: 7b4ef47b7805a402d756fb8157101f64880a522f
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

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

Lines changed: 5 additions & 0 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

branches/snap-stage3/src/doc/trpl/inline-assembly.md

Lines changed: 5 additions & 32 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, or not yet assigned:
80+
expressions must be mutable lvalues:
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 c: i32;
86+
let mut c = 0;
8787
unsafe {
8888
asm!("add $2, $0"
8989
: "=r"(c)
@@ -100,22 +100,6 @@ 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-
119103
## Clobbers
120104

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

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

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/snap-stage3/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/snap-stage3/src/librustc/middle/ty.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5732,10 +5732,8 @@ fn compute_enum_variants<'tcx>(cx: &ctxt<'tcx>,
57325732
Ok(const_eval::const_int(val)) => current_disr_val = val as Disr,
57335733
Ok(const_eval::const_uint(val)) => current_disr_val = val as Disr,
57345734
Ok(_) => {
5735-
let sign_desc = if repr_type.is_signed() { "signed" } else { "unsigned" };
57365735
span_err!(cx.sess, e.span, E0079,
5737-
"expected {} integer constant",
5738-
sign_desc);
5736+
"expected signed integer constant");
57395737
current_disr_val = attempt_fresh_value();
57405738
}
57415739
Err(ref err) => {

branches/snap-stage3/src/librustc_typeck/diagnostics.rs

Lines changed: 4 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -10,85 +10,6 @@
1010

1111
#![allow(non_snake_case)]
1212

13-
register_long_diagnostics! {
14-
15-
E0081: r##"
16-
Enum discriminants are used to differentiate enum variants stored in memory.
17-
This error indicates that the same value was used for two or more variants,
18-
making them impossible to tell apart.
19-
20-
```
21-
// Good.
22-
enum Enum {
23-
P,
24-
X = 3,
25-
Y = 5
26-
}
27-
28-
// Bad.
29-
enum Enum {
30-
P = 3,
31-
X = 3,
32-
Y = 5
33-
}
34-
```
35-
36-
Note that variants without a manually specified discriminant are numbered from
37-
top to bottom starting from 0, so clashes can occur with seemingly unrelated
38-
variants.
39-
40-
```
41-
enum Bad {
42-
X,
43-
Y = 0
44-
}
45-
```
46-
47-
Here `X` will have already been assigned the discriminant 0 by the time `Y` is
48-
encountered, so a conflict occurs.
49-
"##,
50-
51-
E0082: r##"
52-
The default type for enum discriminants is `isize`, but it can be adjusted by
53-
adding the `repr` attribute to the enum declaration. This error indicates that
54-
an integer literal given as a discriminant is not a member of the discriminant
55-
type. For example:
56-
57-
```
58-
#[repr(u8)]
59-
enum Thing {
60-
A = 1024,
61-
B = 5
62-
}
63-
```
64-
65-
Here, 1024 lies outside the valid range for `u8`, so the discriminant for `A` is
66-
invalid. You may want to change representation types to fix this, or else change
67-
invalid discriminant values so that they fit within the existing type.
68-
69-
Note also that without a representation manually defined, the compiler will
70-
optimize by using the smallest integer type possible.
71-
"##,
72-
73-
E0083: r##"
74-
At present, it's not possible to define a custom representation for an enum with
75-
a single variant. As a workaround you can add a `Dummy` variant.
76-
77-
See: https://github.com/rust-lang/rust/issues/10292
78-
"##,
79-
80-
E0084: r##"
81-
It is impossible to define an integer type to be used to represent zero-variant
82-
enum values because there are no zero-variant enum values. There is no way to
83-
construct an instance of the following type using only safe code:
84-
85-
```
86-
enum Empty {}
87-
```
88-
"##
89-
90-
}
91-
9213
register_diagnostics! {
9314
E0023,
9415
E0024,
@@ -130,6 +51,10 @@ register_diagnostics! {
13051
E0075,
13152
E0076,
13253
E0077,
54+
E0081,
55+
E0082,
56+
E0083,
57+
E0084,
13358
E0085,
13459
E0086,
13560
E0087,
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main() {
12+
static foo: Fn() -> u32 = || -> u32 {
13+
//~^ ERROR: mismatched types:
14+
//~| expected `core::ops::Fn() -> u32`,
15+
//~| found closure
16+
//~| (expected trait core::ops::Fn,
17+
//~| found closure)
18+
0
19+
};
20+
}

0 commit comments

Comments
 (0)