Skip to content

Commit 41b7fee

Browse files
committed
---
yaml --- r: 233841 b: refs/heads/beta c: 2076cdd h: refs/heads/master i: 233839: e9e2dfe v: v3
1 parent 8c71c73 commit 41b7fee

File tree

153 files changed

+1256
-2690
lines changed

Some content is hidden

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

153 files changed

+1256
-2690
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: fe9cef7dae8732897820c0e4ca65bc7ee33604be
26+
refs/heads/beta: 2076cddcf235cc8eed4d4a0ad173a1a6bb90c533
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: 370fe2786109360f7c35b8ba552b83b773dd71d6
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ sudo: false
2020
before_script:
2121
- ./configure --enable-ccache
2222
script:
23-
- make tidy && make check -j4
23+
- make tidy check -j4
2424

2525
env:
2626
- CXX=/usr/bin/g++-4.7

branches/beta/README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@ Read ["Installing Rust"] from [The Book].
6565
tools.
6666
6767
```sh
68-
# Update package mirrors (may be needed if you have a fresh install of MSYS2)
69-
$ pacman -Sy pacman-mirrors
70-
7168
# Choose one based on platform:
7269
$ pacman -S mingw-w64-i686-toolchain
7370
$ pacman -S mingw-w64-x86_64-toolchain

branches/beta/mk/main.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ LLVM_VERSION_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --version)
294294
LLVM_BINDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --bindir)
295295
LLVM_INCDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --includedir)
296296
LLVM_LIBDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libdir)
297-
LLVM_LIBDIR_RUSTFLAGS_$(1)=-L native="$$(LLVM_LIBDIR_$(1))"
297+
LLVM_LIBDIR_RUSTFLAGS_$(1)=-L "$$(LLVM_LIBDIR_$(1))"
298298
LLVM_LDFLAGS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --ldflags)
299299
ifeq ($$(findstring freebsd,$(1)),freebsd)
300300
# On FreeBSD, it may search wrong headers (that are for pre-installed LLVM),

branches/beta/src/doc/nomicon/leaking.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ impl<T> Rc<T> {
155155
impl<T> Drop for Rc<T> {
156156
fn drop(&mut self) {
157157
unsafe {
158+
let inner = &mut ;
158159
(*self.ptr).ref_count -= 1;
159160
if (*self.ptr).ref_count == 0 {
160161
// drop the data and then free it

branches/beta/src/doc/trpl/crates-and-modules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ $ ls target/debug
115115
build deps examples libphrases-a7448e02a0468eaa.rlib native
116116
```
117117

118-
`libphrases-hash.rlib` is the compiled crate. Before we see how to use this
118+
`libphrase-hash.rlib` is the compiled crate. Before we see how to use this
119119
crate from another crate, let’s break it up into multiple files.
120120

121121
# Multiple file crates

branches/beta/src/doc/trpl/ffi.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -496,11 +496,9 @@ strings are not terminated with `\0`. If you need a NUL-terminated string for
496496
interoperability with C, you should use the `CString` type in the `std::ffi`
497497
module.
498498

499-
The [`libc` crate on crates.io][libc] includes type aliases and function
500-
definitions for the C standard library in the `libc` module, and Rust links
501-
against `libc` and `libm` by default.
502-
503-
[libc]: https://crates.io/crates/libc
499+
The standard library includes type aliases and function definitions for the C
500+
standard library in the `libc` module, and Rust links against `libc` and `libm`
501+
by default.
504502

505503
# The "nullable pointer optimization"
506504

branches/beta/src/doc/trpl/loops.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ Outputs:
134134
```text
135135
0: Content of line one
136136
1: Content of line two
137-
2: Content of line three
137+
2: Content of line tree
138138
3: Content of line four
139139
```
140140

branches/beta/src/doc/trpl/testing.md

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -120,26 +120,13 @@ And that's reflected in the summary line:
120120
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured
121121
```
122122

123-
We also get a non-zero status code. We can use `$?` on OS X and Linux:
123+
We also get a non-zero status code:
124124

125125
```bash
126126
$ echo $?
127127
101
128128
```
129129

130-
On Windows, if you’re using `cmd`:
131-
132-
```bash
133-
> echo %ERRORLEVEL%
134-
```
135-
136-
And if you’re using PowerShell:
137-
138-
```bash
139-
> echo $LASTEXITCODE # the code itself
140-
> echo $? # a boolean, fail or succeed
141-
```
142-
143130
This is useful if you want to integrate `cargo test` into other tooling.
144131

145132
We can invert our test's failure with another attribute: `should_panic`:

branches/beta/src/liballoc/arc.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ use boxed::Box;
7373

7474
use core::sync::atomic;
7575
use core::sync::atomic::Ordering::{Relaxed, Release, Acquire, SeqCst};
76-
use core::borrow;
7776
use core::fmt;
7877
use core::cmp::Ordering;
7978
use core::mem::{align_of_val, size_of_val};
@@ -1110,7 +1109,3 @@ mod tests {
11101109
assert!(y.upgrade().is_none());
11111110
}
11121111
}
1113-
1114-
impl<T: ?Sized> borrow::Borrow<T> for Arc<T> {
1115-
fn borrow(&self) -> &T { &**self }
1116-
}

branches/beta/src/liballoc/boxed.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ use heap;
5757
use raw_vec::RawVec;
5858

5959
use core::any::Any;
60-
use core::borrow;
6160
use core::cmp::Ordering;
6261
use core::fmt;
6362
use core::hash::{self, Hash};
@@ -563,10 +562,3 @@ impl<T: Clone> Clone for Box<[T]> {
563562
}
564563
}
565564

566-
impl<T: ?Sized> borrow::Borrow<T> for Box<T> {
567-
fn borrow(&self) -> &T { &**self }
568-
}
569-
570-
impl<T: ?Sized> borrow::BorrowMut<T> for Box<T> {
571-
fn borrow_mut(&mut self) -> &mut T { &mut **self }
572-
}

branches/beta/src/liballoc/rc.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ use boxed::Box;
158158
#[cfg(test)]
159159
use std::boxed::Box;
160160

161-
use core::borrow;
162161
use core::cell::Cell;
163162
use core::cmp::Ordering;
164163
use core::fmt;
@@ -1092,7 +1091,3 @@ mod tests {
10921091
assert_eq!(foo, foo.clone());
10931092
}
10941093
}
1095-
1096-
impl<T: ?Sized> borrow::Borrow<T> for Rc<T> {
1097-
fn borrow(&self) -> &T { &**self }
1098-
}

branches/beta/src/libcollections/borrow.rs

Lines changed: 110 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,119 @@ use core::ops::Deref;
2121
use core::option::Option;
2222

2323
use fmt;
24+
use alloc::{boxed, rc, arc};
2425

2526
use self::Cow::*;
2627

27-
pub use core::borrow::{Borrow, BorrowMut};
28+
/// A trait for borrowing data.
29+
///
30+
/// In general, there may be several ways to "borrow" a piece of data. The
31+
/// typical ways of borrowing a type `T` are `&T` (a shared borrow) and `&mut T`
32+
/// (a mutable borrow). But types like `Vec<T>` provide additional kinds of
33+
/// borrows: the borrowed slices `&[T]` and `&mut [T]`.
34+
///
35+
/// When writing generic code, it is often desirable to abstract over all ways
36+
/// of borrowing data from a given type. That is the role of the `Borrow`
37+
/// trait: if `T: Borrow<U>`, then `&U` can be borrowed from `&T`. A given
38+
/// type can be borrowed as multiple different types. In particular, `Vec<T>:
39+
/// Borrow<Vec<T>>` and `Vec<T>: Borrow<[T]>`.
40+
///
41+
/// If you are implementing `Borrow` and both `Self` and `Borrowed` implement
42+
/// `Hash`, `Eq`, and/or `Ord`, they must produce the same result.
43+
///
44+
/// `Borrow` is very similar to, but different than, `AsRef`. See
45+
/// [the book][book] for more.
46+
///
47+
/// [book]: ../../book/borrow-and-asref.html
48+
#[stable(feature = "rust1", since = "1.0.0")]
49+
pub trait Borrow<Borrowed: ?Sized> {
50+
/// Immutably borrows from an owned value.
51+
///
52+
/// # Examples
53+
///
54+
/// ```
55+
/// use std::borrow::Borrow;
56+
///
57+
/// fn check<T: Borrow<str>>(s: T) {
58+
/// assert_eq!("Hello", s.borrow());
59+
/// }
60+
///
61+
/// let s = "Hello".to_string();
62+
///
63+
/// check(s);
64+
///
65+
/// let s = "Hello";
66+
///
67+
/// check(s);
68+
/// ```
69+
#[stable(feature = "rust1", since = "1.0.0")]
70+
fn borrow(&self) -> &Borrowed;
71+
}
72+
73+
/// A trait for mutably borrowing data.
74+
///
75+
/// Similar to `Borrow`, but for mutable borrows.
76+
#[stable(feature = "rust1", since = "1.0.0")]
77+
pub trait BorrowMut<Borrowed: ?Sized> : Borrow<Borrowed> {
78+
/// Mutably borrows from an owned value.
79+
///
80+
/// # Examples
81+
///
82+
/// ```
83+
/// use std::borrow::BorrowMut;
84+
///
85+
/// fn check<T: BorrowMut<[i32]>>(mut v: T) {
86+
/// assert_eq!(&mut [1, 2, 3], v.borrow_mut());
87+
/// }
88+
///
89+
/// let v = vec![1, 2, 3];
90+
///
91+
/// check(v);
92+
/// ```
93+
#[stable(feature = "rust1", since = "1.0.0")]
94+
fn borrow_mut(&mut self) -> &mut Borrowed;
95+
}
96+
97+
#[stable(feature = "rust1", since = "1.0.0")]
98+
impl<T: ?Sized> Borrow<T> for T {
99+
fn borrow(&self) -> &T { self }
100+
}
101+
102+
#[stable(feature = "rust1", since = "1.0.0")]
103+
impl<T: ?Sized> BorrowMut<T> for T {
104+
fn borrow_mut(&mut self) -> &mut T { self }
105+
}
106+
107+
#[stable(feature = "rust1", since = "1.0.0")]
108+
impl<'a, T: ?Sized> Borrow<T> for &'a T {
109+
fn borrow(&self) -> &T { &**self }
110+
}
111+
112+
#[stable(feature = "rust1", since = "1.0.0")]
113+
impl<'a, T: ?Sized> Borrow<T> for &'a mut T {
114+
fn borrow(&self) -> &T { &**self }
115+
}
116+
117+
#[stable(feature = "rust1", since = "1.0.0")]
118+
impl<'a, T: ?Sized> BorrowMut<T> for &'a mut T {
119+
fn borrow_mut(&mut self) -> &mut T { &mut **self }
120+
}
121+
122+
impl<T: ?Sized> Borrow<T> for boxed::Box<T> {
123+
fn borrow(&self) -> &T { &**self }
124+
}
125+
126+
impl<T: ?Sized> BorrowMut<T> for boxed::Box<T> {
127+
fn borrow_mut(&mut self) -> &mut T { &mut **self }
128+
}
129+
130+
impl<T: ?Sized> Borrow<T> for rc::Rc<T> {
131+
fn borrow(&self) -> &T { &**self }
132+
}
133+
134+
impl<T: ?Sized> Borrow<T> for arc::Arc<T> {
135+
fn borrow(&self) -> &T { &**self }
136+
}
28137

29138
#[stable(feature = "rust1", since = "1.0.0")]
30139
impl<'a, B: ?Sized> Borrow<B> for Cow<'a, B> where B: ToOwned, <B as ToOwned>::Owned: 'a {

0 commit comments

Comments
 (0)