Skip to content

Commit e9d11bb

Browse files
committed
---
yaml --- r: 232787 b: refs/heads/try c: 0833d87 h: refs/heads/master i: 232785: e415059 232783: fc568e9 v: v3
1 parent dddfcfc commit e9d11bb

Some content is hidden

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

77 files changed

+1501
-811
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: edeb4f1c86cbf6af8ef9874d4b3af50f721ea1b8
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4-
refs/heads/try: 25cbb4385ee58804cb2483af56d1333fbee6e27d
4+
refs/heads/try: 0833d8776282b39740345bbb5710037eabc67180
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/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 "$$(LLVM_LIBDIR_$(1))"
297+
LLVM_LIBDIR_RUSTFLAGS_$(1)=-L native="$$(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/try/src/doc/reference.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,7 +1452,7 @@ fn draw_twice<T: Shape>(surface: Surface, sh: T) {
14521452
}
14531453
```
14541454

1455-
Traits also define an [trait object](#trait-objects) with the same
1455+
Traits also define a [trait object](#trait-objects) with the same
14561456
name as the trait. Values of this type are created by coercing from a
14571457
pointer of some specific type to a pointer of trait type. For example,
14581458
`&T` could be coerced to `&Shape` if `T: Shape` holds (and similarly
@@ -1881,11 +1881,15 @@ type int8_t = i8;
18811881
- `no_start` - disable linking to the `native` crate, which specifies the
18821882
"start" language item.
18831883
- `no_std` - disable linking to the `std` crate.
1884-
- `plugin` load a list of named crates as compiler plugins, e.g.
1884+
- `plugin` - load a list of named crates as compiler plugins, e.g.
18851885
`#![plugin(foo, bar)]`. Optional arguments for each plugin,
18861886
i.e. `#![plugin(foo(... args ...))]`, are provided to the plugin's
18871887
registrar function. The `plugin` feature gate is required to use
18881888
this attribute.
1889+
- `recursion_limit` - Sets the maximum depth for potentially
1890+
infinitely-recursive compile-time operations like
1891+
auto-dereference or macro expansion. The default is
1892+
`#![recursion_limit="64"]`.
18891893

18901894
### Module-only attributes
18911895

branches/try/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-
`libphrase-hash.rlib` is the compiled crate. Before we see how to use this
118+
`libphrases-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/try/src/doc/trpl/error-handling.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ Because these kinds of situations are relatively rare, use panics sparingly.
208208

209209
In certain circumstances, even though a function may fail, we may want to treat
210210
it as a panic instead. For example, `io::stdin().read_line(&mut buffer)` returns
211-
a `Result<usize>`, when there is an error reading the line. This allows us to
212-
handle and possibly recover from error.
211+
a `Result<usize>`, which can indicate an error if one occurs when reading the line.
212+
This allows us to handle and possibly recover from errors.
213213

214214
If we don't want to handle this error, and would rather just abort the program,
215215
we can use the `unwrap()` method:

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

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,26 @@ 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:
123+
We also get a non-zero status code. We can use `$?` on OS X and Linux:
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+
130143
This is useful if you want to integrate `cargo test` into other tooling.
131144

132145
We can invert our test's failure with another attribute: `should_panic`:
@@ -219,6 +232,66 @@ fn it_works() {
219232
This is a very common use of `assert_eq!`: call some function with
220233
some known arguments and compare it to the expected output.
221234

235+
# The `ignore` attribute
236+
237+
Sometimes a few specific tests can be very time-consuming to execute. These
238+
can be disabled by default by using the `ignore` attribute:
239+
240+
```rust
241+
#[test]
242+
fn it_works() {
243+
assert_eq!(4, add_two(2));
244+
}
245+
246+
#[test]
247+
#[ignore]
248+
fn expensive_test() {
249+
// code that takes an hour to run
250+
}
251+
```
252+
253+
Now we run our tests and see that `it_works` is run, but `expensive_test` is
254+
not:
255+
256+
```bash
257+
$ cargo test
258+
Compiling adder v0.0.1 (file:///home/you/projects/adder)
259+
Running target/adder-91b3e234d4ed382a
260+
261+
running 2 tests
262+
test expensive_test ... ignored
263+
test it_works ... ok
264+
265+
test result: ok. 1 passed; 0 failed; 1 ignored; 0 measured
266+
267+
Doc-tests adder
268+
269+
running 0 tests
270+
271+
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
272+
```
273+
274+
The expensive tests can be run explicitly using `cargo test -- --ignored`:
275+
276+
```bash
277+
$ cargo test -- --ignored
278+
Running target/adder-91b3e234d4ed382a
279+
280+
running 1 test
281+
test expensive_test ... ok
282+
283+
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
284+
285+
Doc-tests adder
286+
287+
running 0 tests
288+
289+
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
290+
```
291+
292+
The `--ignored` argument is an argument to the test binary, and not to cargo,
293+
which is why the command is `cargo test -- --ignored`.
294+
222295
# The `tests` module
223296

224297
There is one way in which our existing example is not idiomatic: it's

branches/try/src/liballoc/arc.rs

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

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

branches/try/src/liballoc/boxed.rs

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

5959
use core::any::Any;
60+
use core::borrow;
6061
use core::cmp::Ordering;
6162
use core::fmt;
6263
use core::hash::{self, Hash};
@@ -562,3 +563,10 @@ impl<T: Clone> Clone for Box<[T]> {
562563
}
563564
}
564565

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/try/src/liballoc/rc.rs

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

161+
use core::borrow;
161162
use core::cell::Cell;
162163
use core::cmp::Ordering;
163164
use core::fmt;
@@ -1091,3 +1092,7 @@ mod tests {
10911092
assert_eq!(foo, foo.clone());
10921093
}
10931094
}
1095+
1096+
impl<T: ?Sized> borrow::Borrow<T> for Rc<T> {
1097+
fn borrow(&self) -> &T { &**self }
1098+
}

branches/try/src/libcollections/borrow.rs

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

2323
use fmt;
24-
use alloc::{boxed, rc, arc};
2524

2625
use self::Cow::*;
2726

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-
}
27+
pub use core::borrow::{Borrow, BorrowMut};
13728

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

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use core::fmt::Debug;
2222
use core::hash::{Hash, Hasher};
2323
use core::iter::{Map, FromIterator};
2424
use core::ops::Index;
25-
use core::{iter, fmt, mem, usize};
25+
use core::{fmt, mem, usize};
2626
use Bound::{self, Included, Excluded, Unbounded};
2727

2828
use borrow::Borrow;
@@ -915,15 +915,15 @@ impl<K: Eq, V: Eq> Eq for BTreeMap<K, V> {}
915915
impl<K: PartialOrd, V: PartialOrd> PartialOrd for BTreeMap<K, V> {
916916
#[inline]
917917
fn partial_cmp(&self, other: &BTreeMap<K, V>) -> Option<Ordering> {
918-
iter::order::partial_cmp(self.iter(), other.iter())
918+
self.iter().partial_cmp(other.iter())
919919
}
920920
}
921921

922922
#[stable(feature = "rust1", since = "1.0.0")]
923923
impl<K: Ord, V: Ord> Ord for BTreeMap<K, V> {
924924
#[inline]
925925
fn cmp(&self, other: &BTreeMap<K, V>) -> Ordering {
926-
iter::order::cmp(self.iter(), other.iter())
926+
self.iter().cmp(other.iter())
927927
}
928928
}
929929

branches/try/src/libcollections/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
#![feature(unicode)]
5757
#![feature(unique)]
5858
#![feature(unsafe_no_drop_flag, filling_drop)]
59+
#![feature(decode_utf16)]
5960
#![feature(utf8_error)]
6061
#![cfg_attr(test, feature(rand, test))]
6162

0 commit comments

Comments
 (0)