Skip to content

Commit 3f48671

Browse files
committed
---
yaml --- r: 207869 b: refs/heads/snap-stage3 c: e962870 h: refs/heads/master i: 207867: a21979b v: v3
1 parent 129fe78 commit 3f48671

File tree

7 files changed

+56
-17
lines changed

7 files changed

+56
-17
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: 63e63218a123bbda1ed47cbe5e8bac62b7e48e97
4+
refs/heads/snap-stage3: e962870420fef19e8f23a299dbe7499aca1656a5
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"
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/snap-stage3/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/snap-stage3/src/doc/reference.md

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

branches/snap-stage3/src/doc/trpl/casting-between-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ what it does is very simple, but very scary. It tells Rust to treat a value of
4343
one type as though it were another type. It does this regardless of the
4444
typechecking system, and just completely trusts you.
4545

46-
[intrinsic]: intrinsics.html
46+
[intrinsics]: intrinsics.html
4747

4848
In our previous example, we know that an array of four `u8`s represents a `u32`
4949
properly, and so we want to do the cast. Using `transmute` instead of `as`,

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

Lines changed: 6 additions & 1 deletion
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`
@@ -519,7 +525,6 @@ a compile-time constant.
519525
}
520526

521527
register_diagnostics! {
522-
E0010,
523528
E0011,
524529
E0012,
525530
E0014,

0 commit comments

Comments
 (0)