Skip to content

Commit ab0d916

Browse files
committed
---
yaml --- r: 273407 b: refs/heads/beta c: 078b288 h: refs/heads/master i: 273405: 4498387 273403: 32b8225 273399: 277919b 273391: e76728e 273375: c244f9e 273343: 6e75a7d 273279: 737377e 273151: 2e9fba5 272895: 0f5cbc5 272383: 2d448ce
1 parent e9bc24d commit ab0d916

File tree

45 files changed

+1681
-203
lines changed

Some content is hidden

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

45 files changed

+1681
-203
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 06d8b21372742234c95e1ea842e4d66aa9ee9dd5
26+
refs/heads/beta: 078b288ebd2261f700e8551f841bfd6396fcf9c5
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/doc/book/error-handling.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2019,6 +2019,16 @@ impl Error for CliError {
20192019
CliError::NotFound => "not found",
20202020
}
20212021
}
2022+
2023+
fn cause(&self) -> Option<&error::Error> {
2024+
match *self {
2025+
CliError::Io(ref err) => Some(err),
2026+
CliError::Parse(ref err) => Some(err),
2027+
// Our custom error doesn't have an underlying cause, but we could
2028+
// modify it so that it does.
2029+
CliError::NotFound() => None,
2030+
}
2031+
}
20222032
}
20232033
```
20242034

branches/beta/src/doc/book/primitive-types.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ of these ones, as well, but these are the most primitive.
77

88
# Booleans
99

10-
Rust has a built in boolean type, named `bool`. It has two values, `true` and `false`:
10+
Rust has a built-in boolean type, named `bool`. It has two values, `true` and `false`:
1111

1212
```rust
1313
let x = true;
@@ -89,13 +89,13 @@ Unsigned types use a `u` for their category, and signed types use `i`. The `i`
8989
is for ‘integer’. So `u8` is an eight-bit unsigned number, and `i8` is an
9090
eight-bit signed number.
9191

92-
## Fixed size types
92+
## Fixed-size types
9393

94-
Fixed size types have a specific number of bits in their representation. Valid
94+
Fixed-size types have a specific number of bits in their representation. Valid
9595
bit sizes are `8`, `16`, `32`, and `64`. So, `u32` is an unsigned, 32-bit integer,
9696
and `i64` is a signed, 64-bit integer.
9797

98-
## Variable sized types
98+
## Variable-size types
9999

100100
Rust also provides types whose size depends on the size of a pointer of the
101101
underlying machine. These types have ‘size’ as the category, and come in signed

branches/beta/src/libcore/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
authors = ["The Rust Project Developers"]
33
name = "core"
44
version = "0.0.0"
5+
build = "build.rs"
56

67
[lib]
78
name = "core"

branches/beta/src/libcore/build.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2016 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+
// Remove this whenever snapshots and rustbuild nightlies are synced.
13+
println!("cargo:rustc-cfg=cargobuild");
14+
}

branches/beta/src/libcore/char.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -416,14 +416,14 @@ pub fn encode_utf16_raw(mut ch: u32, dst: &mut [u16]) -> Option<usize> {
416416
///
417417
/// [`escape_unicode()`]: ../../std/primitive.char.html#method.escape_unicode
418418
/// [`char`]: ../../std/primitive.char.html
419-
#[derive(Clone)]
419+
#[derive(Clone, Debug)]
420420
#[stable(feature = "rust1", since = "1.0.0")]
421421
pub struct EscapeUnicode {
422422
c: char,
423423
state: EscapeUnicodeState
424424
}
425425

426-
#[derive(Clone)]
426+
#[derive(Clone, Debug)]
427427
enum EscapeUnicodeState {
428428
Backslash,
429429
Type,
@@ -496,13 +496,13 @@ impl Iterator for EscapeUnicode {
496496
///
497497
/// [`escape_default()`]: ../../std/primitive.char.html#method.escape_default
498498
/// [`char`]: ../../std/primitive.char.html
499-
#[derive(Clone)]
499+
#[derive(Clone, Debug)]
500500
#[stable(feature = "rust1", since = "1.0.0")]
501501
pub struct EscapeDefault {
502502
state: EscapeDefaultState
503503
}
504504

505-
#[derive(Clone)]
505+
#[derive(Clone, Debug)]
506506
enum EscapeDefaultState {
507507
Backslash(char),
508508
Char(char),

branches/beta/src/libcore/cmp.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,21 @@
1414
//! by the compiler to implement comparison operators. Rust programs may
1515
//! implement `PartialOrd` to overload the `<`, `<=`, `>`, and `>=` operators,
1616
//! and may implement `PartialEq` to overload the `==` and `!=` operators.
17+
//!
18+
//! # Examples
19+
//!
20+
//! ```
21+
//! let x: u32 = 0;
22+
//! let y: u32 = 1;
23+
//!
24+
//! // these two lines are equivalent
25+
//! assert_eq!(x < y, true);
26+
//! assert_eq!(x.lt(&y), true);
27+
//!
28+
//! // these two lines are also equivalent
29+
//! assert_eq!(x == y, false);
30+
//! assert_eq!(x.eq(&y), false);
31+
//! ```
1732
1833
#![stable(feature = "rust1", since = "1.0.0")]
1934

@@ -44,6 +59,16 @@ use option::Option::{self, Some};
4459
/// only if `a != b`.
4560
///
4661
/// This trait can be used with `#[derive]`.
62+
///
63+
/// # Examples
64+
///
65+
/// ```
66+
/// let x: u32 = 0;
67+
/// let y: u32 = 1;
68+
///
69+
/// assert_eq!(x == y, false);
70+
/// assert_eq!(x.eq(&y), false);
71+
/// ```
4772
#[lang = "eq"]
4873
#[stable(feature = "rust1", since = "1.0.0")]
4974
pub trait PartialEq<Rhs: ?Sized = Self> {
@@ -226,6 +251,16 @@ impl PartialOrd for Ordering {
226251
///
227252
/// This trait can be used with `#[derive]`. When `derive`d, it will produce an ordering
228253
/// based on the top-to-bottom declaration order of the struct's members.
254+
///
255+
/// # Examples
256+
///
257+
/// ```
258+
/// let x : u32 = 0;
259+
/// let y : u32 = 1;
260+
///
261+
/// assert_eq!(x < y, true);
262+
/// assert_eq!(x.lt(&y), true);
263+
/// ```
229264
#[lang = "ord"]
230265
#[stable(feature = "rust1", since = "1.0.0")]
231266
pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {

branches/beta/src/libcore/fmt/builders.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ impl<'a, 'b: 'a> fmt::Write for PadAdapter<'a, 'b> {
5454
///
5555
/// Constructed by the `Formatter::debug_struct` method.
5656
#[must_use]
57+
#[allow(missing_debug_implementations)]
5758
#[stable(feature = "debug_builders", since = "1.2.0")]
5859
pub struct DebugStruct<'a, 'b: 'a> {
5960
fmt: &'a mut fmt::Formatter<'b>,
@@ -120,6 +121,7 @@ impl<'a, 'b: 'a> DebugStruct<'a, 'b> {
120121
///
121122
/// Constructed by the `Formatter::debug_tuple` method.
122123
#[must_use]
124+
#[allow(missing_debug_implementations)]
123125
#[stable(feature = "debug_builders", since = "1.2.0")]
124126
pub struct DebugTuple<'a, 'b: 'a> {
125127
fmt: &'a mut fmt::Formatter<'b>,
@@ -231,6 +233,7 @@ impl<'a, 'b: 'a> DebugInner<'a, 'b> {
231233
///
232234
/// Constructed by the `Formatter::debug_set` method.
233235
#[must_use]
236+
#[allow(missing_debug_implementations)]
234237
#[stable(feature = "debug_builders", since = "1.2.0")]
235238
pub struct DebugSet<'a, 'b: 'a> {
236239
inner: DebugInner<'a, 'b>,
@@ -279,6 +282,7 @@ impl<'a, 'b: 'a> DebugSet<'a, 'b> {
279282
///
280283
/// Constructed by the `Formatter::debug_list` method.
281284
#[must_use]
285+
#[allow(missing_debug_implementations)]
282286
#[stable(feature = "debug_builders", since = "1.2.0")]
283287
pub struct DebugList<'a, 'b: 'a> {
284288
inner: DebugInner<'a, 'b>,
@@ -327,6 +331,7 @@ impl<'a, 'b: 'a> DebugList<'a, 'b> {
327331
///
328332
/// Constructed by the `Formatter::debug_map` method.
329333
#[must_use]
334+
#[allow(missing_debug_implementations)]
330335
#[stable(feature = "debug_builders", since = "1.2.0")]
331336
pub struct DebugMap<'a, 'b: 'a> {
332337
fmt: &'a mut fmt::Formatter<'b>,

branches/beta/src/libcore/fmt/mod.rs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
use prelude::v1::*;
1616

17-
use cell::{Cell, RefCell, Ref, RefMut, BorrowState};
17+
use cell::{UnsafeCell, Cell, RefCell, Ref, RefMut, BorrowState};
1818
use marker::PhantomData;
1919
use mem;
2020
use num::flt2dec;
@@ -25,6 +25,7 @@ use str;
2525

2626
#[unstable(feature = "fmt_flags_align", issue = "27726")]
2727
/// Possible alignments returned by `Formatter::align`
28+
#[derive(Debug)]
2829
pub enum Alignment {
2930
/// Indication that contents should be left-aligned.
3031
Left,
@@ -152,6 +153,7 @@ impl<'a, W: Write + ?Sized> Write for &'a mut W {
152153
/// A struct to represent both where to emit formatting strings to and how they
153154
/// should be formatted. A mutable version of this is passed to all formatting
154155
/// traits.
156+
#[allow(missing_debug_implementations)]
155157
#[stable(feature = "rust1", since = "1.0.0")]
156158
pub struct Formatter<'a> {
157159
flags: u32,
@@ -175,6 +177,7 @@ enum Void {}
175177
/// compile time it is ensured that the function and the value have the correct
176178
/// types, and then this struct is used to canonicalize arguments to one type.
177179
#[derive(Copy)]
180+
#[allow(missing_debug_implementations)]
178181
#[unstable(feature = "fmt_internals", reason = "internal to format_args!",
179182
issue = "0")]
180183
#[doc(hidden)]
@@ -1585,7 +1588,9 @@ impl<T: ?Sized> Debug for PhantomData<T> {
15851588
#[stable(feature = "rust1", since = "1.0.0")]
15861589
impl<T: Copy + Debug> Debug for Cell<T> {
15871590
fn fmt(&self, f: &mut Formatter) -> Result {
1588-
write!(f, "Cell {{ value: {:?} }}", self.get())
1591+
f.debug_struct("Cell")
1592+
.field("value", &self.get())
1593+
.finish()
15891594
}
15901595
}
15911596

@@ -1594,9 +1599,15 @@ impl<T: ?Sized + Debug> Debug for RefCell<T> {
15941599
fn fmt(&self, f: &mut Formatter) -> Result {
15951600
match self.borrow_state() {
15961601
BorrowState::Unused | BorrowState::Reading => {
1597-
write!(f, "RefCell {{ value: {:?} }}", self.borrow())
1602+
f.debug_struct("RefCell")
1603+
.field("value", &self.borrow())
1604+
.finish()
1605+
}
1606+
BorrowState::Writing => {
1607+
f.debug_struct("RefCell")
1608+
.field("value", &"<borrowed>")
1609+
.finish()
15981610
}
1599-
BorrowState::Writing => write!(f, "RefCell {{ <borrowed> }}"),
16001611
}
16011612
}
16021613
}
@@ -1615,5 +1626,12 @@ impl<'b, T: ?Sized + Debug> Debug for RefMut<'b, T> {
16151626
}
16161627
}
16171628

1629+
#[stable(feature = "core_impl_debug", since = "1.9.0")]
1630+
impl<T: ?Sized + Debug> Debug for UnsafeCell<T> {
1631+
fn fmt(&self, f: &mut Formatter) -> Result {
1632+
f.pad("UnsafeCell")
1633+
}
1634+
}
1635+
16181636
// If you expected tests to be here, look instead at the run-pass/ifmt.rs test,
16191637
// it's a lot easier than creating all of the rt::Piece structures here.

branches/beta/src/libcore/fmt/rt/v1.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
//!
1414
//! These definitions are similar to their `ct` equivalents, but differ in that
1515
//! these can be statically allocated and are slightly optimized for the runtime
16+
#![allow(missing_debug_implementations)]
1617

1718
#[derive(Copy, Clone)]
1819
pub struct Argument {

branches/beta/src/libcore/hash/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373

7474
use prelude::v1::*;
7575

76+
use fmt;
7677
use marker;
7778
use mem;
7879

@@ -215,6 +216,13 @@ pub trait BuildHasher {
215216
#[stable(since = "1.7.0", feature = "build_hasher")]
216217
pub struct BuildHasherDefault<H>(marker::PhantomData<H>);
217218

219+
#[stable(since = "1.9.0", feature = "core_impl_debug")]
220+
impl<H> fmt::Debug for BuildHasherDefault<H> {
221+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
222+
f.pad("BuildHasherDefault")
223+
}
224+
}
225+
218226
#[stable(since = "1.7.0", feature = "build_hasher")]
219227
impl<H: Default + Hasher> BuildHasher for BuildHasherDefault<H> {
220228
type Hasher = H;

branches/beta/src/libcore/hash/sip.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ use super::Hasher;
3030
/// Although the SipHash algorithm is considered to be generally strong,
3131
/// it is not intended for cryptographic purposes. As such, all
3232
/// cryptographic uses of this implementation are _strongly discouraged_.
33+
#[derive(Debug)]
3334
#[stable(feature = "rust1", since = "1.0.0")]
3435
pub struct SipHasher {
3536
k0: u64,

branches/beta/src/libcore/intrinsics.rs

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -53,53 +53,44 @@ extern "rust-intrinsic" {
5353
// NB: These intrinsics take raw pointers because they mutate aliased
5454
// memory, which is not valid for either `&` or `&mut`.
5555

56-
#[cfg(stage0)]
56+
#[cfg(all(stage0, not(cargobuild)))]
5757
pub fn atomic_cxchg<T>(dst: *mut T, old: T, src: T) -> T;
58-
#[cfg(stage0)]
58+
#[cfg(all(stage0, not(cargobuild)))]
5959
pub fn atomic_cxchg_acq<T>(dst: *mut T, old: T, src: T) -> T;
60-
#[cfg(stage0)]
60+
#[cfg(all(stage0, not(cargobuild)))]
6161
pub fn atomic_cxchg_rel<T>(dst: *mut T, old: T, src: T) -> T;
62-
#[cfg(stage0)]
62+
#[cfg(all(stage0, not(cargobuild)))]
6363
pub fn atomic_cxchg_acqrel<T>(dst: *mut T, old: T, src: T) -> T;
64-
#[cfg(stage0)]
64+
#[cfg(all(stage0, not(cargobuild)))]
6565
pub fn atomic_cxchg_relaxed<T>(dst: *mut T, old: T, src: T) -> T;
6666

67-
#[cfg(not(stage0))]
67+
#[cfg(any(not(stage0), cargobuild))]
6868
pub fn atomic_cxchg<T>(dst: *mut T, old: T, src: T) -> (T, bool);
69-
#[cfg(not(stage0))]
69+
#[cfg(any(not(stage0), cargobuild))]
7070
pub fn atomic_cxchg_acq<T>(dst: *mut T, old: T, src: T) -> (T, bool);
71-
#[cfg(not(stage0))]
71+
#[cfg(any(not(stage0), cargobuild))]
7272
pub fn atomic_cxchg_rel<T>(dst: *mut T, old: T, src: T) -> (T, bool);
73-
#[cfg(not(stage0))]
73+
#[cfg(any(not(stage0), cargobuild))]
7474
pub fn atomic_cxchg_acqrel<T>(dst: *mut T, old: T, src: T) -> (T, bool);
75-
#[cfg(not(stage0))]
75+
#[cfg(any(not(stage0), cargobuild))]
7676
pub fn atomic_cxchg_relaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
77-
#[cfg(not(stage0))]
77+
#[cfg(any(not(stage0), cargobuild))]
7878
pub fn atomic_cxchg_failrelaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
79-
#[cfg(not(stage0))]
79+
#[cfg(any(not(stage0), cargobuild))]
8080
pub fn atomic_cxchg_failacq<T>(dst: *mut T, old: T, src: T) -> (T, bool);
81-
#[cfg(not(stage0))]
81+
#[cfg(any(not(stage0), cargobuild))]
8282
pub fn atomic_cxchg_acq_failrelaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
83-
#[cfg(not(stage0))]
83+
#[cfg(any(not(stage0), cargobuild))]
8484
pub fn atomic_cxchg_acqrel_failrelaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
8585

86-
#[cfg(not(stage0))]
8786
pub fn atomic_cxchgweak<T>(dst: *mut T, old: T, src: T) -> (T, bool);
88-
#[cfg(not(stage0))]
8987
pub fn atomic_cxchgweak_acq<T>(dst: *mut T, old: T, src: T) -> (T, bool);
90-
#[cfg(not(stage0))]
9188
pub fn atomic_cxchgweak_rel<T>(dst: *mut T, old: T, src: T) -> (T, bool);
92-
#[cfg(not(stage0))]
9389
pub fn atomic_cxchgweak_acqrel<T>(dst: *mut T, old: T, src: T) -> (T, bool);
94-
#[cfg(not(stage0))]
9590
pub fn atomic_cxchgweak_relaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
96-
#[cfg(not(stage0))]
9791
pub fn atomic_cxchgweak_failrelaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
98-
#[cfg(not(stage0))]
9992
pub fn atomic_cxchgweak_failacq<T>(dst: *mut T, old: T, src: T) -> (T, bool);
100-
#[cfg(not(stage0))]
10193
pub fn atomic_cxchgweak_acq_failrelaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
102-
#[cfg(not(stage0))]
10394
pub fn atomic_cxchgweak_acqrel_failrelaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
10495

10596
pub fn atomic_load<T>(src: *const T) -> T;

0 commit comments

Comments
 (0)