Skip to content

Commit c9f2e79

Browse files
committed
---
yaml --- r: 219739 b: refs/heads/snap-stage3 c: 9d67b9f h: refs/heads/master i: 219737: 543648f 219735: 20f3fe2 v: v3
1 parent 20fbb1c commit c9f2e79

File tree

29 files changed

+1186
-496
lines changed

29 files changed

+1186
-496
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: c044791d80ea0dc5c4b57b6030a67b69f8510239
3-
refs/heads/snap-stage3: 49b73e46d68f96e8afc8346c5d3a0ccb38f7c634
3+
refs/heads/snap-stage3: 9d67b9f0f90a43e822d09201291603fc0f7601b3
44
refs/heads/try: b53c0f93eedcdedd4fd89bccc5a3a09d1c5cd23e
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/snap-stage3/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Rust is a fast systems programming language that guarantees
44
memory safety and offers painless concurrency ([no data races]).
55
It does not employ a garbage collector and has minimal runtime overhead.
66

7-
This repo contains the code for `rustc`, the Rust compiler, as well
7+
This repo contains the code for the compiler (`rustc`), as well
88
as standard libraries, tools and documentation for Rust.
99

1010
[no data races]: http://blog.rust-lang.org/2015/04/10/Fearless-Concurrency.html

branches/snap-stage3/src/doc/trpl/academic-research.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Recommended for inspiration and a better understanding of Rust's background.
1212
* [Macros that work together](https://www.cs.utah.edu/plt/publications/jfp12-draft-fcdf.pdf)
1313
* [Traits: composable units of behavior](http://scg.unibe.ch/archive/papers/Scha03aTraits.pdf)
1414
* [Alias burying](http://www.cs.uwm.edu/faculty/boyland/papers/unique-preprint.ps) - We tried something similar and abandoned it.
15-
* [External uniqueness is unique enough](http://www.computingscience.nl/research/techreps/repo/CS-2002/2002-048.pdf)
15+
* [External uniqueness is unique enough](http://www.cs.uu.nl/research/techreps/UU-CS-2002-048.html)
1616
* [Uniqueness and Reference Immutability for Safe Parallelism](https://research.microsoft.com/pubs/170528/msr-tr-2012-79.pdf)
1717
* [Region Based Memory Management](http://www.cs.ucla.edu/~palsberg/tba/papers/tofte-talpin-iandc97.pdf)
1818

@@ -26,10 +26,10 @@ Recommended for inspiration and a better understanding of Rust's background.
2626
* [Dynamic circular work stealing deque](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.170.1097&rep=rep1&type=pdf) - The Chase/Lev deque
2727
* [Work-first and help-first scheduling policies for async-finish task parallelism](http://www.cs.rice.edu/%7Eyguo/pubs/PID824943.pdf) - More general than fully-strict work stealing
2828
* [A Java fork/join calamity](http://www.coopsoft.com/ar/CalamityArticle.html) - critique of Java's fork/join library, particularly its application of work stealing to non-strict computation
29-
* [Scheduling techniques for concurrent systems](http://www.ece.rutgers.edu/%7Eparashar/Classes/ece572-papers/05/ps-ousterhout.pdf)
29+
* [Scheduling techniques for concurrent systems](http://www.stanford.edu/~ouster/cgi-bin/papers/coscheduling.pdf)
3030
* [Contention aware scheduling](http://www.blagodurov.net/files/a8-blagodurov.pdf)
3131
* [Balanced work stealing for time-sharing multicores](http://www.cse.ohio-state.edu/hpcs/WWW/HTML/publications/papers/TR-12-1.pdf)
32-
* [Three layer cake](http://www.upcrc.illinois.edu/workshops/paraplop10/papers/paraplop10_submission_8.pdf)
32+
* [Three layer cake for shared-memory programming](http://dl.acm.org/citation.cfm?id=1953616&dl=ACM&coll=DL&CFID=524387192&CFTOKEN=44362705)
3333
* [Non-blocking steal-half work queues](http://www.cs.bgu.ac.il/%7Ehendlerd/papers/p280-hendler.pdf)
3434
* [Reagents: expressing and composing fine-grained concurrency](http://www.mpi-sws.org/~turon/reagents.pdf)
3535
* [Algorithms for scalable synchronization of shared-memory multiprocessors](https://www.cs.rochester.edu/u/scott/papers/1991_TOCS_synch.pdf)

branches/snap-stage3/src/doc/trpl/documentation.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@ pub fn new(value: T) -> Rc<T> {
3333
```
3434

3535
This code generates documentation that looks [like this][rc-new]. I've left the
36-
implementation out, with a regular comment in its place. That's the first thing
37-
to notice about this annotation: it uses `///`, instead of `//`. The triple slash
36+
implementation out, with a regular comment in its place.
37+
38+
The first thing to notice about this annotation is that it uses
39+
`///` instead of `//`. The triple slash
3840
indicates a documentation comment.
3941

4042
Documentation comments are written in Markdown.
@@ -375,7 +377,7 @@ $ rustdoc --test path/to/my/crate/root.rs
375377
$ cargo test
376378
```
377379

378-
That's right, `cargo test` tests embedded documentation too. However,
380+
That's right, `cargo test` tests embedded documentation too. However,
379381
`cargo test` will not test binary crates, only library ones. This is
380382
due to the way `rustdoc` works: it links against the library to be tested,
381383
but with a binary, there’s nothing to link to.

branches/snap-stage3/src/doc/trpl/link-args.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Note that this feature is currently hidden behind the `feature(link_args)` gate
1717
because this is not a sanctioned way of performing linking. Right now rustc
1818
shells out to the system linker, so it makes sense to provide extra command line
1919
arguments, but this will not always be the case. In the future rustc may use
20-
LLVM directly to link native libraries in which case `link_args` will have no
20+
LLVM directly to link native libraries, in which case `link_args` will have no
2121
meaning.
2222

2323
It is highly recommended to *not* use this attribute, and rather use the more

branches/snap-stage3/src/libcollections/fmt.rs

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,15 @@
128128
//! This allows multiple actual types to be formatted via `{:x}` (like `i8` as
129129
//! well as `isize`). The current mapping of types to traits is:
130130
//!
131-
//! * *nothing* ⇒ `Display`
132-
//! * `?` ⇒ `Debug`
133-
//! * `o` ⇒ `Octal`
134-
//! * `x` ⇒ `LowerHex`
135-
//! * `X` ⇒ `UpperHex`
136-
//! * `p` ⇒ `Pointer`
137-
//! * `b` ⇒ `Binary`
138-
//! * `e` ⇒ `LowerExp`
139-
//! * `E` ⇒ `UpperExp`
131+
//! * *nothing* ⇒ [`Display`](trait.Display.html)
132+
//! * `?` ⇒ [`Debug`](trait.Debug.html)
133+
//! * `o` ⇒ [`Octal`](trait.Octal.html)
134+
//! * `x` ⇒ [`LowerHex`](trait.LowerHex.html)
135+
//! * `X` ⇒ [`UpperHex`](trait.UpperHex.html)
136+
//! * `p` ⇒ [`Pointer`](trait.Pointer.html)
137+
//! * `b` ⇒ [`Binary`](trait.Binary.html)
138+
//! * `e` ⇒ [`LowerExp`](trait.LowerExp.html)
139+
//! * `E` ⇒ [`UpperExp`](trait.UpperExp.html)
140140
//!
141141
//! What this means is that any type of argument which implements the
142142
//! `fmt::Binary` trait can then be formatted with `{:b}`. Implementations
@@ -367,11 +367,11 @@
367367
//! should always be printed.
368368
//! * '-' - Currently not used
369369
//! * '#' - This flag is indicates that the "alternate" form of printing should
370-
//! be used. For array slices, the alternate form omits the brackets.
371-
//! For the integer formatting traits, the alternate forms are:
370+
//! be used. The alternate forms are:
371+
//! * `#?` - pretty-print the `Debug` formatting
372372
//! * `#x` - precedes the argument with a "0x"
373373
//! * `#X` - precedes the argument with a "0x"
374-
//! * `#t` - precedes the argument with a "0b"
374+
//! * `#b` - precedes the argument with a "0b"
375375
//! * `#o` - precedes the argument with a "0o"
376376
//! * '0' - This is used to indicate for integer formats that the padding should
377377
//! both be done with a `0` character as well as be sign-aware. A format
@@ -408,19 +408,20 @@
408408
//!
409409
//! There are three possible ways to specify the desired `precision`:
410410
//!
411-
//! There are three possible ways to specify the desired `precision`:
412-
//! 1. An integer `.N`,
413-
//! 2. an integer followed by dollar sign `.N$`, or
414-
//! 3. an asterisk `.*`.
411+
//! 1. An integer `.N`:
412+
//!
413+
//! the integer `N` itself is the precision.
414+
//!
415+
//! 2. An integer followed by dollar sign `.N$`:
415416
//!
416-
//! The first specification, `.N`, means the integer `N` itself is the precision.
417+
//! use format *argument* `N` (which must be a `usize`) as the precision.
417418
//!
418-
//! The second, `.N$`, means use format *argument* `N` (which must be a `usize`) as the precision.
419+
//! 3. An asterisk `.*`:
419420
//!
420-
//! Finally, `.*` means that this `{...}` is associated with *two* format inputs rather than one:
421-
//! the first input holds the `usize` precision, and the second holds the value to print. Note
422-
//! that in this case, if one uses the format string `{<arg>:<spec>.*}`, then the `<arg>` part
423-
//! refers to the *value* to print, and the `precision` must come in the input preceding `<arg>`.
421+
//! `.*` means that this `{...}` is associated with *two* format inputs rather than one: the
422+
//! first input holds the `usize` precision, and the second holds the value to print. Note that
423+
//! in this case, if one uses the format string `{<arg>:<spec>.*}`, then the `<arg>` part refers
424+
//! to the *value* to print, and the `precision` must come in the input preceding `<arg>`.
424425
//!
425426
//! For example, these:
426427
//!

branches/snap-stage3/src/libcollectionstest/str.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ fn test_split_at() {
705705
#[should_panic]
706706
fn test_split_at_boundscheck() {
707707
let s = "ศไทย中华Việt Nam";
708-
let (a, b) = s.split_at(1);
708+
s.split_at(1);
709709
}
710710

711711
#[test]
@@ -1820,6 +1820,14 @@ mod pattern {
18201820
Match (4, 6),
18211821
Reject(6, 7),
18221822
]);
1823+
make_test!(str_searcher_ascii_haystack_seq, "bb", "abbcbbbbd", [
1824+
Reject(0, 1),
1825+
Match (1, 3),
1826+
Reject(3, 4),
1827+
Match (4, 6),
1828+
Match (6, 8),
1829+
Reject(8, 9),
1830+
]);
18231831
make_test!(str_searcher_empty_needle_ascii_haystack, "", "abbcbbd", [
18241832
Match (0, 0),
18251833
Reject(0, 1),

branches/snap-stage3/src/libcore/cmp.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ impl Ordering {
166166
///
167167
/// - total and antisymmetric: exactly one of `a < b`, `a == b` or `a > b` is true; and
168168
/// - transitive, `a < b` and `b < c` implies `a < c`. The same must hold for both `==` and `>`.
169+
///
170+
/// When this trait is `derive`d, it produces a lexicographic ordering.
169171
#[stable(feature = "rust1", since = "1.0.0")]
170172
pub trait Ord: Eq + PartialOrd<Self> {
171173
/// This method returns an `Ordering` between `self` and `other`.

branches/snap-stage3/src/libcore/fmt/mod.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ impl<'a> Display for Arguments<'a> {
267267
}
268268
}
269269

270-
/// Format trait for the `:?` format. Useful for debugging, all types
270+
/// Format trait for the `?` character. Useful for debugging, all types
271271
/// should implement this.
272272
///
273273
/// Generally speaking, you should just `derive` a `Debug` implementation.
@@ -312,6 +312,9 @@ impl<'a> Display for Arguments<'a> {
312312
/// There are a number of `debug_*` methods on `Formatter` to help you with manual
313313
/// implementations, such as [`debug_struct`][debug_struct].
314314
///
315+
/// `Debug` implementations using either `derive` or the debug builder API
316+
/// on `Formatter` support pretty printing using the alternate flag: `{:#?}`.
317+
///
315318
/// [debug_struct]: ../std/fmt/struct.Formatter.html#method.debug_struct
316319
#[stable(feature = "rust1", since = "1.0.0")]
317320
#[rustc_on_unimplemented = "`{Self}` cannot be formatted using `:?`; if it is \
@@ -980,7 +983,14 @@ impl Debug for char {
980983
#[stable(feature = "rust1", since = "1.0.0")]
981984
impl Display for char {
982985
fn fmt(&self, f: &mut Formatter) -> Result {
983-
f.write_char(*self)
986+
if f.width.is_none() && f.precision.is_none() {
987+
f.write_char(*self)
988+
} else {
989+
let mut utf8 = [0; 4];
990+
let amt = self.encode_utf8(&mut utf8).unwrap_or(0);
991+
let s: &str = unsafe { mem::transmute(&utf8[..amt]) };
992+
f.pad(s)
993+
}
984994
}
985995
}
986996

branches/snap-stage3/src/libcore/mem.rs

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,11 +365,48 @@ pub fn replace<T>(dest: &mut T, mut src: T) -> T {
365365

366366
/// Disposes of a value.
367367
///
368-
/// This function can be used to destroy any value by allowing `drop` to take ownership of its
369-
/// argument.
368+
/// While this does call the argument's implementation of `Drop`, it will not
369+
/// release any borrows, as borrows are based on lexical scope.
370370
///
371371
/// # Examples
372372
///
373+
/// Basic usage:
374+
///
375+
/// ```
376+
/// let v = vec![1, 2, 3];
377+
///
378+
/// drop(v); // explicitly drop the vector
379+
/// ```
380+
///
381+
/// Borrows are based on lexical scope, so this produces an error:
382+
///
383+
/// ```ignore
384+
/// let mut v = vec![1, 2, 3];
385+
/// let x = &v[0];
386+
///
387+
/// drop(x); // explicitly drop the reference, but the borrow still exists
388+
///
389+
/// v.push(4); // error: cannot borrow `v` as mutable because it is also
390+
/// // borrowed as immutable
391+
/// ```
392+
///
393+
/// An inner scope is needed to fix this:
394+
///
395+
/// ```
396+
/// let mut v = vec![1, 2, 3];
397+
///
398+
/// {
399+
/// let x = &v[0];
400+
///
401+
/// drop(x); // this is now redundant, as `x` is going out of scope anyway
402+
/// }
403+
///
404+
/// v.push(4); // no problems
405+
/// ```
406+
///
407+
/// Since `RefCell` enforces the borrow rules at runtime, `drop()` can
408+
/// seemingly release a borrow of one:
409+
///
373410
/// ```
374411
/// use std::cell::RefCell;
375412
///

0 commit comments

Comments
 (0)