Skip to content

Commit dcf5dcf

Browse files
committed
---
yaml --- r: 210169 b: refs/heads/try c: 70020aa h: refs/heads/master i: 210167: bce8feb v: v3
1 parent 5e03de6 commit dcf5dcf

File tree

188 files changed

+7925
-5226
lines changed

Some content is hidden

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

188 files changed

+7925
-5226
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: 2fdd1b01987314c0b0fc27a3a572d452c0b29ab1
5+
refs/heads/try: 70020aa0665c9144f13202e13ec071f5eaf56075
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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,13 +544,14 @@ 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"
551551
opt docs 1 "build standard library documentation"
552552
opt compiler-docs 0 "build compiler documentation"
553553
opt optimize-tests 1 "build tests with optimizations"
554+
opt debuginfo-tests 0 "build tests with debugger metadata"
554555
opt libcpp 1 "build with llvm with libc++ instead of libstdc++ when using clang"
555556
opt llvm-assertions 0 "build LLVM with assertions"
556557
opt debug-assertions 0 "build with debugging assertions"

branches/try/mk/tests.mk

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,13 @@ ifndef CFG_DISABLE_OPTIMIZE_TESTS
632632
CTEST_RUSTC_FLAGS += -O
633633
endif
634634

635+
# Analogously to the above, whether to pass `-g` when compiling tests
636+
# is a separate choice from whether to pass `-g` when building the
637+
# compiler and standard library themselves.
638+
CTEST_RUSTC_FLAGS := $$(subst -g,,$$(CTEST_RUSTC_FLAGS))
639+
ifdef CFG_ENABLE_DEBUGINFO_TESTS
640+
CTEST_RUSTC_FLAGS += -g
641+
endif
635642

636643
CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
637644
--compile-lib-path $$(HLIB$(1)_H_$(3)) \

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/not_found.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,12 @@ function populate_rust_search() {
5757

5858
// #18540, use a single token
5959

60+
var a = document.createElement("a");
61+
a.href = "http://doc.rust-lang.org/core/?search=" + encodeURIComponent(lt);
62+
a.textContent = lt;
6063
var search = document.getElementById('core-search');
61-
search.innerHTML = "<a href=\"http://doc.rust-lang.org/core/?search=" + lt + "\">" + lt + "</a>";
64+
search.innerHTML = "";
65+
search.appendChild(a);
6266
}
6367
populate_site_search();
6468
populate_rust_search();

branches/try/src/doc/reference.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ Non-doc comments are interpreted as a form of whitespace.
103103

104104
## Whitespace
105105

106-
Whitespace is any non-empty string containing any the following characters:
106+
Whitespace is any non-empty string containing only the following characters:
107107

108108
- `U+0020` (space, `' '`)
109109
- `U+0009` (tab, `'\t'`)
@@ -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
@@ -1896,8 +1891,8 @@ release builds.
18961891

18971892
There are two kinds of configuration options, one that is either defined or not
18981893
(`#[cfg(foo)]`), and the other that contains a string that can be checked
1899-
against (`#[cfg(bar = "baz")]` (currently only compiler-defined configuration
1900-
options can have the latter form).
1894+
against (`#[cfg(bar = "baz")]`). Currently, only compiler-defined configuration
1895+
options can have the latter form.
19011896

19021897
```
19031898
// The function is only included in the build when compiling for OSX

branches/try/src/doc/trpl/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ vector. When we try to compile this program, we get an error:
127127

128128
```text
129129
error: cannot borrow `x` as mutable because it is also borrowed as immutable
130-
x.push(4);
130+
x.push("foo");
131131
^
132132
note: previous borrow of `x` occurs here; the immutable borrow prevents
133133
subsequent moves or mutable borrows of `x` until the borrow ends

branches/try/src/doc/trpl/benchmark-tests.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub fn add_two(a: i32) -> i32 {
1313
}
1414
1515
#[cfg(test)]
16-
mod test {
16+
mod tests {
1717
use super::*;
1818
use test::Bencher;
1919

branches/try/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/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/macros.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ as `unimplemented!` until you’re ready to write them.
765765
# Procedural macros
766766

767767
If Rust’s macro system can’t do what you need, you may want to write a
768-
[compiler plugin](plugins.html) instead. Compared to `macro_rules!`
768+
[compiler plugin](compiler-plugins.html) instead. Compared to `macro_rules!`
769769
macros, this is significantly more work, the interfaces are much less stable,
770770
and bugs can be much harder to track down. In exchange you get the
771771
flexibility of running arbitrary Rust code within the compiler. Syntax

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/intrinsics.rs

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,21 @@ extern "rust-intrinsic" {
139139
pub fn atomic_fence_rel();
140140
pub fn atomic_fence_acqrel();
141141

142+
/// A compiler-only memory barrier.
143+
///
144+
/// Memory accesses will never be reordered across this barrier by the compiler,
145+
/// but no instructions will be emitted for it. This is appropriate for operations
146+
/// on the same thread that may be preempted, such as when interacting with signal
147+
/// handlers.
148+
#[cfg(not(stage0))] // SNAP 857ef6e
149+
pub fn atomic_singlethreadfence();
150+
#[cfg(not(stage0))] // SNAP 857ef6e
151+
pub fn atomic_singlethreadfence_acq();
152+
#[cfg(not(stage0))] // SNAP 857ef6e
153+
pub fn atomic_singlethreadfence_rel();
154+
#[cfg(not(stage0))] // SNAP 857ef6e
155+
pub fn atomic_singlethreadfence_acqrel();
156+
142157
/// Aborts the execution of the process.
143158
pub fn abort() -> !;
144159

@@ -255,12 +270,17 @@ extern "rust-intrinsic" {
255270
/// Returns `true` if a type is managed (will be allocated on the local heap)
256271
pub fn owns_managed<T>() -> bool;
257272

258-
/// Calculates the offset from a pointer. The offset *must* be in-bounds of
259-
/// the object, or one-byte-past-the-end. An arithmetic overflow is also
260-
/// undefined behaviour.
273+
/// Calculates the offset from a pointer.
261274
///
262275
/// This is implemented as an intrinsic to avoid converting to and from an
263276
/// integer, since the conversion would throw away aliasing information.
277+
///
278+
/// # Safety
279+
///
280+
/// Both the starting and resulting pointer must be either in bounds or one
281+
/// byte past the end of an allocated object. If either pointer is out of
282+
/// bounds or arithmetic overflow occurs then any further use of the
283+
/// returned value will result in undefined behavior.
264284
pub fn offset<T>(dst: *const T, offset: isize) -> *const T;
265285

266286
/// Copies `count * size_of<T>` bytes from `src` to `dst`. The source
@@ -562,3 +582,20 @@ extern "rust-intrinsic" {
562582
/// cast to a `u64`; if `T` has no discriminant, returns 0.
563583
pub fn discriminant_value<T>(v: &T) -> u64;
564584
}
585+
586+
#[cfg(not(stage0))]
587+
extern "rust-intrinsic" {
588+
/// Performs an unchecked signed division, which results in undefined behavior,
589+
/// in cases where y == 0, or x == int::MIN and y == -1
590+
pub fn unchecked_sdiv<T>(x: T, y: T) -> T;
591+
/// Performs an unchecked unsigned division, which results in undefined behavior,
592+
/// in cases where y == 0
593+
pub fn unchecked_udiv<T>(x: T, y: T) -> T;
594+
595+
/// Returns the remainder of an unchecked signed division, which results in
596+
/// undefined behavior, in cases where y == 0, or x == int::MIN and y == -1
597+
pub fn unchecked_urem<T>(x: T, y: T) -> T;
598+
/// Returns the remainder of an unchecked signed division, which results in
599+
/// undefined behavior, in cases where y == 0
600+
pub fn unchecked_srem<T>(x: T, y: T) -> T;
601+
}

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/libcore/num/mod.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,20 @@ macro_rules! uint_impl {
745745
#[stable(feature = "rust1", since = "1.0.0")]
746746
#[inline]
747747
pub fn trailing_zeros(self) -> u32 {
748-
unsafe { $cttz(self as $ActualT) as u32 }
748+
// As of LLVM 3.6 the codegen for the zero-safe cttz8 intrinsic
749+
// emits two conditional moves on x86_64. By promoting the value to
750+
// u16 and setting bit 8, we get better code without any conditional
751+
// operations.
752+
// FIXME: There's a LLVM patch (http://reviews.llvm.org/D9284)
753+
// pending, remove this workaround once LLVM generates better code
754+
// for cttz8.
755+
unsafe {
756+
if $BITS == 8 {
757+
intrinsics::cttz16(self as u16 | 0x100) as u32
758+
} else {
759+
$cttz(self as $ActualT) as u32
760+
}
761+
}
749762
}
750763

751764
/// Shifts the bits to the left by a specified amount, `n`,

0 commit comments

Comments
 (0)