Skip to content

Commit c7ead30

Browse files
committed
---
yaml --- r: 191465 b: refs/heads/try c: dbd16a5 h: refs/heads/master i: 191463: cd53b31 v: v3
1 parent 074b4ec commit c7ead30

File tree

33 files changed

+145
-553
lines changed

33 files changed

+145
-553
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: 809a554fca2d0ebc2ba50077016fe282a4064752
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: c64d671671aea2e44ee7fc6eb00ee75fc30ed7b9
5-
refs/heads/try: d5408f376f93123a043845b69d467d4b7686ae86
5+
refs/heads/try: dbd16a5b475606f1131cd41529be830ee89e7221
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/src/compiletest/compiletest.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#![feature(unboxed_closures)]
2020
#![feature(std_misc)]
2121
#![feature(test)]
22+
#![feature(core)]
2223
#![feature(path_ext)]
2324

2425
#![deny(warnings)]

branches/try/src/doc/reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2068,7 +2068,7 @@ type int8_t = i8;
20682068
item](#language-items) for more details.
20692069
- `test` - indicates that this function is a test function, to only be compiled
20702070
in case of `--test`.
2071-
- `should_panic` - indicates that this test function should panic, inverting the success condition.
2071+
- `should_fail` - indicates that this test function should panic, inverting the success condition.
20722072
- `cold` - The function is unlikely to be executed, so optimize it (and calls
20732073
to it) differently.
20742074

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -562,11 +562,6 @@ place in the hierarchy instead. There's one more special form of `use`: you can
562562
people like to think of `self` as `.` and `super` as `..`, from many shells'
563563
display for the current directory and the parent directory.
564564
565-
Outside of `use`, paths are relative: `foo::bar()` refers to a function inside
566-
of `foo` relative to where we are. If that's prefixed with `::`, as in
567-
`::foo::bar()`, it refers to a different `foo`, an absolute path from your
568-
crate root.
569-
570565
Also, note that we `pub use`d before we declared our `mod`s. Rust requires that
571566
`use` declarations go first.
572567

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ Because this function will cause a crash, it will never return, and so it has
179179
the type '`!`', which is read "diverges." A diverging function can be used
180180
as any type:
181181

182-
```should_panic
182+
```should_fail
183183
# fn diverges() -> ! {
184184
# panic!("This function never returns!");
185185
# }

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ $ echo $?
129129

130130
This is useful if you want to integrate `cargo test` into other tooling.
131131

132-
We can invert our test's failure with another attribute: `should_panic`:
132+
We can invert our test's failure with another attribute: `should_fail`:
133133

134134
```rust
135135
#[test]
136-
#[should_panic]
136+
#[should_fail]
137137
fn it_works() {
138138
assert!(false);
139139
}
@@ -163,13 +163,13 @@ equality:
163163

164164
```rust
165165
#[test]
166-
#[should_panic]
166+
#[should_fail]
167167
fn it_works() {
168168
assert_eq!("Hello", "world");
169169
}
170170
```
171171

172-
Does this test pass or fail? Because of the `should_panic` attribute, it
172+
Does this test pass or fail? Because of the `should_fail` attribute, it
173173
passes:
174174

175175
```bash
@@ -189,15 +189,15 @@ running 0 tests
189189
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
190190
```
191191

192-
`should_panic` tests can be fragile, as it's hard to guarantee that the test
192+
`should_fail` tests can be fragile, as it's hard to guarantee that the test
193193
didn't fail for an unexpected reason. To help with this, an optional `expected`
194-
parameter can be added to the `should_panic` attribute. The test harness will
194+
parameter can be added to the `should_fail` attribute. The test harness will
195195
make sure that the failure message contains the provided text. A safer version
196196
of the example above would be:
197197

198198
```
199199
#[test]
200-
#[should_panic(expected = "assertion failed")]
200+
#[should_fail(expected = "assertion failed")]
201201
fn it_works() {
202202
assert_eq!("Hello", "world");
203203
}

branches/try/src/liballoc/arc.rs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,21 @@ impl<T> Arc<T> {
210210
// contents.
211211
unsafe { &**self._ptr }
212212
}
213+
214+
// Non-inlined part of `drop`.
215+
#[inline(never)]
216+
unsafe fn drop_slow(&mut self) {
217+
let ptr = *self._ptr;
218+
219+
// Destroy the data at this time, even though we may not free the box allocation itself
220+
// (there may still be weak pointers lying around).
221+
drop(ptr::read(&self.inner().data));
222+
223+
if self.inner().weak.fetch_sub(1, Release) == 1 {
224+
atomic::fence(Acquire);
225+
deallocate(ptr as *mut u8, size_of::<ArcInner<T>>(), min_align_of::<ArcInner<T>>())
226+
}
227+
}
213228
}
214229

215230
/// Get the number of weak references to this value.
@@ -325,6 +340,7 @@ impl<T: Sync + Send> Drop for Arc<T> {
325340
///
326341
/// } // implicit drop
327342
/// ```
343+
#[inline]
328344
fn drop(&mut self) {
329345
// This structure has #[unsafe_no_drop_flag], so this drop glue may run more than once (but
330346
// it is guaranteed to be zeroed after the first if it's run more than once)
@@ -353,14 +369,8 @@ impl<T: Sync + Send> Drop for Arc<T> {
353369
// [1]: (www.boost.org/doc/libs/1_55_0/doc/html/atomic/usage_examples.html)
354370
atomic::fence(Acquire);
355371

356-
// Destroy the data at this time, even though we may not free the box allocation itself
357-
// (there may still be weak pointers lying around).
358-
unsafe { drop(ptr::read(&self.inner().data)); }
359-
360-
if self.inner().weak.fetch_sub(1, Release) == 1 {
361-
atomic::fence(Acquire);
362-
unsafe { deallocate(ptr as *mut u8, size_of::<ArcInner<T>>(),
363-
min_align_of::<ArcInner<T>>()) }
372+
unsafe {
373+
self.drop_slow()
364374
}
365375
}
366376
}

branches/try/src/libcollections/fmt.rs

Lines changed: 27 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
//! This macro is implemented in the compiler to emit calls to this module in
1717
//! order to format arguments at runtime into strings and streams.
1818
//!
19-
//! # Usage
19+
//! ## Usage
2020
//!
2121
//! The `format!` macro is intended to be familiar to those coming from C's
2222
//! printf/fprintf functions or Python's `str.format` function. In its current
@@ -41,7 +41,7 @@
4141
//! will then parse the format string and determine if the list of arguments
4242
//! provided is suitable to pass to this format string.
4343
//!
44-
//! ## Positional parameters
44+
//! ### Positional parameters
4545
//!
4646
//! Each formatting argument is allowed to specify which value argument it's
4747
//! referencing, and if omitted it is assumed to be "the next argument". For
@@ -54,7 +54,7 @@
5454
//! iterator over the argument. Each time a "next argument" specifier is seen,
5555
//! the iterator advances. This leads to behavior like this:
5656
//!
57-
//! ```
57+
//! ```rust
5858
//! format!("{1} {} {0} {}", 1, 2); // => "2 1 1 2"
5959
//! ```
6060
//!
@@ -68,7 +68,7 @@
6868
//! compile-time error. You may refer to the same argument more than once in the
6969
//! format string, although it must always be referred to with the same type.
7070
//!
71-
//! ## Named parameters
71+
//! ### Named parameters
7272
//!
7373
//! Rust itself does not have a Python-like equivalent of named parameters to a
7474
//! function, but the `format!` macro is a syntax extension which allows it to
@@ -91,7 +91,7 @@
9191
//! arguments which have names. Like with positional parameters, it is illegal
9292
//! to provide named parameters that are unused by the format string.
9393
//!
94-
//! ## Argument types
94+
//! ### Argument types
9595
//!
9696
//! Each argument's type is dictated by the format string. It is a requirement
9797
//! that every argument is only ever referred to by one type. For example, this
@@ -105,25 +105,18 @@
105105
//! hexadecimal as well as an
106106
//! octal.
107107
//!
108-
//! There are various parameters which do require a particular type, however. Namely, the `{:.*}`
109-
//! syntax, which sets the number of numbers after the decimal in floating-point types:
110-
//!
111-
//! ```
112-
//! let formatted_number = format!("{:.*}", 2, 1.234567);
113-
//!
114-
//! assert_eq!("1.23", formatted_number)
115-
//! ```
116-
//!
117-
//! If this syntax is used, then the number of characters to print precedes the actual object being
118-
//! formatted, and the number of characters must have the type `usize`. Although a `usize` can be
119-
//! printed with `{}`, it is illegal to reference an argument as such. For example this is another
108+
//! There are various parameters which do require a particular type, however.
109+
//! Namely if the syntax `{:.*}` is used, then the number of characters to print
110+
//! precedes the actual object being formatted, and the number of characters
111+
//! must have the type `usize`. Although a `usize` can be printed with `{}`, it is
112+
//! illegal to reference an argument as such. For example this is another
120113
//! invalid format string:
121114
//!
122115
//! ```text
123116
//! {:.*} {0}
124117
//! ```
125118
//!
126-
//! ## Formatting traits
119+
//! ### Formatting traits
127120
//!
128121
//! When requesting that an argument be formatted with a particular type, you
129122
//! are actually requesting that an argument ascribes to a particular trait.
@@ -149,7 +142,7 @@
149142
//! When implementing a format trait for your own type, you will have to
150143
//! implement a method of the signature:
151144
//!
152-
//! ```
145+
//! ```rust
153146
//! # use std::fmt;
154147
//! # struct Foo; // our custom type
155148
//! # impl fmt::Display for Foo {
@@ -173,7 +166,7 @@
173166
//! An example of implementing the formatting traits would look
174167
//! like:
175168
//!
176-
//! ```
169+
//! ```rust
177170
//! use std::fmt;
178171
//! use std::f64;
179172
//! use std::num::Float;
@@ -218,7 +211,7 @@
218211
//! }
219212
//! ```
220213
//!
221-
//! ### fmt::Display vs fmt::Debug
214+
//! #### fmt::Display vs fmt::Debug
222215
//!
223216
//! These two formatting traits have distinct purposes:
224217
//!
@@ -238,7 +231,7 @@
238231
//! assert_eq!(format!("{} {:?}", "foo\n", "bar\n"), "foo\n \"bar\\n\"");
239232
//! ```
240233
//!
241-
//! ## Related macros
234+
//! ### Related macros
242235
//!
243236
//! There are a number of related macros in the `format!` family. The ones that
244237
//! are currently implemented are:
@@ -252,33 +245,32 @@
252245
//! format_args! // described below.
253246
//! ```
254247
//!
255-
//! ### `write!`
248+
//! #### `write!`
256249
//!
257250
//! This and `writeln` are two macros which are used to emit the format string
258251
//! to a specified stream. This is used to prevent intermediate allocations of
259252
//! format strings and instead directly write the output. Under the hood, this
260253
//! function is actually invoking the `write` function defined in this module.
261254
//! Example usage is:
262255
//!
263-
//! ```
256+
//! ```rust
264257
//! # #![allow(unused_must_use)]
265258
//! let mut w = Vec::new();
266259
//! write!(&mut w, "Hello {}!", "world");
267260
//! ```
268261
//!
269-
//! ### `print!`
262+
//! #### `print!`
270263
//!
271264
//! This and `println` emit their output to stdout. Similarly to the `write!`
272265
//! macro, the goal of these macros is to avoid intermediate allocations when
273266
//! printing output. Example usage is:
274267
//!
275-
//! ```
268+
//! ```rust
276269
//! print!("Hello {}!", "world");
277270
//! println!("I have a newline {}", "character at the end");
278271
//! ```
279272
//!
280-
//! ### `format_args!`
281-
//!
273+
//! #### `format_args!`
282274
//! This is a curious macro which is used to safely pass around
283275
//! an opaque object describing the format string. This object
284276
//! does not require any heap allocations to create, and it only
@@ -311,7 +303,7 @@
311303
//! it would internally pass around this structure until it has been determined
312304
//! where output should go to.
313305
//!
314-
//! # Syntax
306+
//! ## Syntax
315307
//!
316308
//! The syntax for the formatting language used is drawn from other languages,
317309
//! so it should not be too alien. Arguments are formatted with python-like
@@ -334,14 +326,14 @@
334326
//! parameter := integer '$'
335327
//! ```
336328
//!
337-
//! # Formatting Parameters
329+
//! ## Formatting Parameters
338330
//!
339331
//! Each argument being formatted can be transformed by a number of formatting
340332
//! parameters (corresponding to `format_spec` in the syntax above). These
341333
//! parameters affect the string representation of what's being formatted. This
342334
//! syntax draws heavily from Python's, so it may seem a bit familiar.
343335
//!
344-
//! ## Fill/Alignment
336+
//! ### Fill/Alignment
345337
//!
346338
//! The fill character is provided normally in conjunction with the `width`
347339
//! parameter. This indicates that if the value being formatted is smaller than
@@ -353,7 +345,7 @@
353345
//! * `^` - the argument is center-aligned in `width` columns
354346
//! * `>` - the argument is right-aligned in `width` columns
355347
//!
356-
//! ## Sign/#/0
348+
//! ### Sign/#/0
357349
//!
358350
//! These can all be interpreted as flags for a particular formatter.
359351
//!
@@ -376,7 +368,7 @@
376368
//! same format would yield `-0000001` for the integer `-1`. Notice that
377369
//! the negative version has one fewer zero than the positive version.
378370
//!
379-
//! ## Width
371+
//! ### Width
380372
//!
381373
//! This is a parameter for the "minimum width" that the format should take up.
382374
//! If the value's string does not fill up this many characters, then the
@@ -392,7 +384,7 @@
392384
//! parameters by using the `2$` syntax indicating that the second argument is a
393385
//! `usize` specifying the width.
394386
//!
395-
//! ## Precision
387+
//! ### Precision
396388
//!
397389
//! For non-numeric types, this can be considered a "maximum width". If the
398390
//! resulting string is longer than this width, then it is truncated down to
@@ -403,7 +395,7 @@
403395
//! For floating-point types, this indicates how many digits after the decimal
404396
//! point should be printed.
405397
//!
406-
//! # Escaping
398+
//! ## Escaping
407399
//!
408400
//! The literal characters `{` and `}` may be included in a string by preceding
409401
//! them with the same character. For example, the `{` character is escaped with

branches/try/src/libcollectionstest/vec_deque.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ fn test_mut_rev_iter_wrap() {
360360
assert_eq!(d.pop_front(), Some(1));
361361
d.push_back(4);
362362

363-
assert_eq!(d.iter_mut().rev().map(|x| *x).collect::<Vec<_>>(),
363+
assert_eq!(d.iter_mut().rev().cloned().collect::<Vec<_>>(),
364364
vec![4, 3, 2]);
365365
}
366366

0 commit comments

Comments
 (0)