Skip to content

Commit 2a717bf

Browse files
committed
---
yaml --- r: 277209 b: refs/heads/try c: 412e6f7 h: refs/heads/master i: 277207: 486e70f
1 parent 9a9ab54 commit 2a717bf

File tree

24 files changed

+553
-230
lines changed

24 files changed

+553
-230
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: 6dbb0e86aec11050480beb76eade6fb805010ba7
33
refs/heads/snap-stage3: 235d77457d80b549dad3ac36d94f235208a1eafb
4-
refs/heads/try: 05afa68f7d98ae1e28358428cb077ce9c18d034e
4+
refs/heads/try: 412e6f7e84986c8b9216eafb1d952c576312fe3f
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ are:
307307
[gsearchdocs]: https://www.google.com/search?q=site:doc.rust-lang.org+your+query+here
308308
[rif]: http://internals.rust-lang.org
309309
[rr]: https://doc.rust-lang.org/book/README.html
310-
[tlgba]: http://tomlee.co/2014/04/03/a-more-detailed-tour-of-the-rust-compiler/
310+
[tlgba]: http://tomlee.co/2014/04/a-more-detailed-tour-of-the-rust-compiler/
311311
[ro]: http://www.rustaceans.org/
312312
[rctd]: ./COMPILER_TESTS.md
313313
[cheatsheet]: http://buildbot.rust-lang.org/homu/

branches/try/src/doc/book/casting-between-types.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,15 @@ Rust lets us:
165165
```rust
166166
use std::mem;
167167

168-
unsafe {
169-
let a = [0u8, 0u8, 0u8, 0u8];
170-
171-
let b = mem::transmute::<[u8; 4], u32>(a);
168+
fn main() {
169+
unsafe {
170+
let a = [0u8, 1u8, 0u8, 0u8];
171+
let b = mem::transmute::<[u8; 4], u32>(a);
172+
println!("{}", b); // 256
173+
// or, more concisely:
174+
let c: u32 = mem::transmute(a);
175+
println!("{}", c); // 256
176+
}
172177
}
173178
```
174179

branches/try/src/libcollections/btree/node.rs

Lines changed: 176 additions & 5 deletions
Large diffs are not rendered by default.

branches/try/src/libcore/iter.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -901,12 +901,17 @@ pub trait Iterator {
901901
Enumerate { iter: self, count: 0 }
902902
}
903903

904-
/// Creates an iterator which can look at the `next()` element without
905-
/// consuming it.
904+
/// Creates an iterator which can use `peek` to look at the next element of
905+
/// the iterator without consuming it.
906906
///
907907
/// Adds a [`peek()`] method to an iterator. See its documentation for
908908
/// more information.
909909
///
910+
/// Note that the underlying iterator is still advanced when `peek` is
911+
/// called for the first time: In order to retrieve the next element,
912+
/// `next` is called on the underlying iterator, hence any side effects of
913+
/// the `next` method will occur.
914+
///
910915
/// [`peek()`]: struct.Peekable.html#method.peek
911916
///
912917
/// # Examples

branches/try/src/libcore/num/mod.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,23 @@ use slice::SliceExt;
3838
/// all standard arithmetic operations on the underlying value are
3939
/// intended to have wrapping semantics.
4040
#[stable(feature = "rust1", since = "1.0.0")]
41-
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Debug, Default)]
41+
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Default, Hash)]
4242
pub struct Wrapping<T>(#[stable(feature = "rust1", since = "1.0.0")] pub T);
4343

44+
#[stable(feature = "rust1", since = "1.0.0")]
45+
impl<T: fmt::Debug> fmt::Debug for Wrapping<T> {
46+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
47+
self.0.fmt(f)
48+
}
49+
}
50+
51+
#[stable(feature = "wrapping_display", since = "1.10.0")]
52+
impl<T: fmt::Display> fmt::Display for Wrapping<T> {
53+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
54+
self.0.fmt(f)
55+
}
56+
}
57+
4458
mod wrapping;
4559

4660
// All these modules are technically private and only exposed for libcoretest:

branches/try/src/libcore/ptr.rs

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,17 @@ pub unsafe fn replace<T>(dest: *mut T, mut src: T) -> T {
119119
/// `src` is not used before the data is overwritten again (e.g. with `write`,
120120
/// `zero_memory`, or `copy_memory`). Note that `*src = foo` counts as a use
121121
/// because it will attempt to drop the value previously at `*src`.
122+
///
123+
/// # Examples
124+
///
125+
/// Basic usage:
126+
///
127+
/// ```
128+
/// let x = 12;
129+
/// let y = &x as *const i32;
130+
///
131+
/// unsafe { println!("{}", std::ptr::read(y)); }
132+
/// ```
122133
#[inline(always)]
123134
#[stable(feature = "rust1", since = "1.0.0")]
124135
pub unsafe fn read<T>(src: *const T) -> T {
@@ -155,6 +166,21 @@ pub unsafe fn read_and_drop<T>(dest: *mut T) -> T {
155166
///
156167
/// This is appropriate for initializing uninitialized memory, or overwriting
157168
/// memory that has previously been `read` from.
169+
///
170+
/// # Examples
171+
///
172+
/// Basic usage:
173+
///
174+
/// ```
175+
/// let mut x = 0;
176+
/// let y = &mut x as *mut i32;
177+
/// let z = 12;
178+
///
179+
/// unsafe {
180+
/// std::ptr::write(y, z);
181+
/// println!("{}", std::ptr::read(y));
182+
/// }
183+
/// ```
158184
#[inline]
159185
#[stable(feature = "rust1", since = "1.0.0")]
160186
pub unsafe fn write<T>(dst: *mut T, src: T) {
@@ -185,6 +211,17 @@ pub unsafe fn write<T>(dst: *mut T, src: T) {
185211
/// `src` is not used before the data is overwritten again (e.g. with `write`,
186212
/// `zero_memory`, or `copy_memory`). Note that `*src = foo` counts as a use
187213
/// because it will attempt to drop the value previously at `*src`.
214+
///
215+
/// # Examples
216+
///
217+
/// Basic usage:
218+
///
219+
/// ```
220+
/// let x = 12;
221+
/// let y = &x as *const i32;
222+
///
223+
/// unsafe { println!("{}", std::ptr::read_volatile(y)); }
224+
/// ```
188225
#[inline]
189226
#[stable(feature = "volatile", since = "1.9.0")]
190227
pub unsafe fn read_volatile<T>(src: *const T) -> T {
@@ -217,6 +254,21 @@ pub unsafe fn read_volatile<T>(src: *const T) -> T {
217254
///
218255
/// This is appropriate for initializing uninitialized memory, or overwriting
219256
/// memory that has previously been `read` from.
257+
///
258+
/// # Examples
259+
///
260+
/// Basic usage:
261+
///
262+
/// ```
263+
/// let mut x = 0;
264+
/// let y = &mut x as *mut i32;
265+
/// let z = 12;
266+
///
267+
/// unsafe {
268+
/// std::ptr::write_volatile(y, z);
269+
/// println!("{}", std::ptr::read_volatile(y));
270+
/// }
271+
/// ```
220272
#[inline]
221273
#[stable(feature = "volatile", since = "1.9.0")]
222274
pub unsafe fn write_volatile<T>(dst: *mut T, src: T) {

branches/try/src/librustc/session/config.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -888,8 +888,9 @@ pub fn rustc_short_optgroups() -> Vec<RustcOptGroup> {
888888
vec![
889889
opt::flag_s("h", "help", "Display this message"),
890890
opt::multi_s("", "cfg", "Configure the compilation environment", "SPEC"),
891-
opt::multi_s("L", "", "Add a directory to the library search path",
892-
"[KIND=]PATH"),
891+
opt::multi_s("L", "", "Add a directory to the library search path. The
892+
optional KIND can be one of dependency, crate, native,
893+
framework or all (the default).", "[KIND=]PATH"),
893894
opt::multi_s("l", "", "Link the generated crate(s) to the specified native
894895
library NAME. The optional KIND can be one of
895896
static, dylib, or framework. If omitted, dylib is

branches/try/src/librustc_resolve/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@ crate-type = ["dylib"]
1212
log = { path = "../liblog" }
1313
syntax = { path = "../libsyntax" }
1414
rustc = { path = "../librustc" }
15-
rustc_bitflags = { path = "../librustc_bitflags" }
1615
arena = { path = "../libarena" }

0 commit comments

Comments
 (0)