Skip to content

Commit 516a1f8

Browse files
committed
---
yaml --- r: 211759 b: refs/heads/auto c: 1999d75 h: refs/heads/master i: 211757: 6e6ea4a 211755: dfc44c7 211751: 54286cc 211743: 281c0d1 v: v3
1 parent b367af3 commit 516a1f8

Some content is hidden

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

54 files changed

+1021
-331
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: 8746b1ac6f3c95383a19ad2ab365a62140516206
13+
refs/heads/auto: 1999d759f7076d935dc433f3bd6dabd1f0634762
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/CONTRIBUTING.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ feature. We use the 'fork and pull' model described there.
8484
Please make pull requests against the `master` branch.
8585

8686
All pull requests are reviewed by another person. We have a bot,
87-
@rust-highfive, that will automatically assign a random person to review your request.
87+
@rust-highfive, that will automatically assign a random person to review your
88+
request.
8889

8990
If you want to request that a specific person reviews your pull request,
9091
you can add an `r?` to the message. For example, Steve usually reviews
@@ -124,6 +125,10 @@ To save @bors some work, and to get small changes through more quickly, when
124125
the other rollup-eligible patches too, and they'll get tested and merged at
125126
the same time.
126127

128+
To find documentation-related issues, sort by the [A-docs label][adocs].
129+
130+
[adocs]: https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3AA-docs
131+
127132
## Issue Triage
128133

129134
Sometimes, an issue will stay open, even though the bug has been fixed. And
@@ -132,8 +137,40 @@ meantime.
132137

133138
It can be helpful to go through older bug reports and make sure that they are
134139
still valid. Load up an older issue, double check that it's still true, and
135-
leave a comment letting us know if it is or is not. The [least recently updated sort][lru] is good for finding issues like this.
140+
leave a comment letting us know if it is or is not. The [least recently
141+
updated sort][lru] is good for finding issues like this.
142+
143+
Contributors with sufficient permissions on the Rust repo can help by adding
144+
labels to triage issues:
145+
146+
* Yellow, **A**-prefixed labels state which **area** of the project an issue
147+
relates to.
148+
149+
* Magenta, **B**-prefixed labels identify bugs which **belong** elsewhere.
150+
151+
* Green, **E**-prefixed labels explain the level of **experience** necessary
152+
to fix the issue.
153+
154+
* Red, **I**-prefixed labels indicate the **importance** of the issue. The
155+
[I-nominated][inom] label indicates that an issue has been nominated for
156+
prioritizing at the next triage meeting.
157+
158+
* Orange, **P**-prefixed labels indicate a bug's **priority**. These labels
159+
are only assigned during triage meetings, and replace the [I-nominated][inom]
160+
label.
161+
162+
* Blue, **T**-prefixed bugs denote which **team** the issue belongs to.
163+
164+
* Dark blue, **beta-** labels track changes which need to be backported into
165+
the beta branches.
166+
167+
* The purple **metabug** label marks lists of bugs collected by other
168+
categories.
169+
170+
If you're looking for somewhere to start, check out the [E-easy][eeasy] tag.
136171

172+
[inom]: https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3AI-nominated
173+
[eeasy]: https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3AE-easy
137174
[lru]: https://github.com/rust-lang/rust/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-asc
138175

139176
## Out-of-tree Contributions

branches/auto/src/doc/reference.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3255,8 +3255,8 @@ User-defined types have limited capabilities.
32553255
The primitive types are the following:
32563256

32573257
* The boolean type `bool` with values `true` and `false`.
3258-
* The machine types.
3259-
* The machine-dependent integer and floating-point types.
3258+
* The machine types (integer and floating-point).
3259+
* The machine-dependent integer types.
32603260

32613261
#### Machine types
32623262

branches/auto/src/doc/style/errors/ergonomics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@ for more details.
6363
### The `Result`-`impl` pattern [FIXME]
6464

6565
> **[FIXME]** Document the way that the `io` module uses trait impls
66-
> on `IoResult` to painlessly propagate errors.
66+
> on `std::io::Result` to painlessly propagate errors.

branches/auto/src/doc/style/features/functions-and-methods/input.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ The primary exception: sometimes a function is meant to modify data
121121
that the caller already owns, for example to re-use a buffer:
122122

123123
```rust
124-
fn read(&mut self, buf: &mut [u8]) -> IoResult<usize>
124+
fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize>
125125
```
126126

127127
(From the [Reader trait](http://static.rust-lang.org/doc/master/std/io/trait.Reader.html#tymethod.read).)

branches/auto/src/doc/style/ownership/builders.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl Command {
7575
}
7676

7777
/// Executes the command as a child process, which is returned.
78-
pub fn spawn(&self) -> IoResult<Process> {
78+
pub fn spawn(&self) -> std::io::Result<Process> {
7979
...
8080
}
8181
}

branches/auto/src/doc/trpl/conditional-compilation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ These can nest arbitrarily:
3434
As for how to enable or disable these switches, if you’re using Cargo,
3535
they get set in the [`[features]` section][features] of your `Cargo.toml`:
3636

37-
[features]: http://doc.crates.io/manifest.html#the-[features]-section
37+
[features]: http://doc.crates.io/manifest.html#the-%5Bfeatures%5D-section
3838

3939
```toml
4040
[features]

branches/auto/src/doc/trpl/glossary.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ In the example above `x` and `y` have arity 2. `z` has arity 3.
1919

2020
When a compiler is compiling your program, it does a number of different
2121
things. One of the things that it does is turn the text of your program into an
22-
‘abstract syntax tree’, or‘AST’. This tree is a representation of the
22+
‘abstract syntax tree’, or ‘AST’. This tree is a representation of the
2323
structure of your program. For example, `2 + 3` can be turned into a tree:
2424

2525
```text

branches/auto/src/libcollections/binary_heap.rs

Lines changed: 88 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@
153153
use core::prelude::*;
154154

155155
use core::iter::{FromIterator};
156-
use core::mem::{zeroed, replace, swap};
156+
use core::mem::swap;
157157
use core::ptr;
158158

159159
use slice;
@@ -484,46 +484,42 @@ impl<T: Ord> BinaryHeap<T> {
484484

485485
// The implementations of sift_up and sift_down use unsafe blocks in
486486
// order to move an element out of the vector (leaving behind a
487-
// zeroed element), shift along the others and move it back into the
488-
// vector over the junk element. This reduces the constant factor
489-
// compared to using swaps, which involves twice as many moves.
490-
fn sift_up(&mut self, start: usize, mut pos: usize) {
487+
// hole), shift along the others and move the removed element back into the
488+
// vector at the final location of the hole.
489+
// The `Hole` type is used to represent this, and make sure
490+
// the hole is filled back at the end of its scope, even on panic.
491+
// Using a hole reduces the constant factor compared to using swaps,
492+
// which involves twice as many moves.
493+
fn sift_up(&mut self, start: usize, pos: usize) {
491494
unsafe {
492-
let new = replace(&mut self.data[pos], zeroed());
495+
// Take out the value at `pos` and create a hole.
496+
let mut hole = Hole::new(&mut self.data, pos);
493497

494-
while pos > start {
495-
let parent = (pos - 1) >> 1;
496-
497-
if new <= self.data[parent] { break; }
498-
499-
let x = replace(&mut self.data[parent], zeroed());
500-
ptr::write(&mut self.data[pos], x);
501-
pos = parent;
498+
while hole.pos() > start {
499+
let parent = (hole.pos() - 1) / 2;
500+
if hole.removed() <= hole.get(parent) { break }
501+
hole.move_to(parent);
502502
}
503-
ptr::write(&mut self.data[pos], new);
504503
}
505504
}
506505

507506
fn sift_down_range(&mut self, mut pos: usize, end: usize) {
507+
let start = pos;
508508
unsafe {
509-
let start = pos;
510-
let new = replace(&mut self.data[pos], zeroed());
511-
509+
let mut hole = Hole::new(&mut self.data, pos);
512510
let mut child = 2 * pos + 1;
513511
while child < end {
514512
let right = child + 1;
515-
if right < end && !(self.data[child] > self.data[right]) {
513+
if right < end && !(hole.get(child) > hole.get(right)) {
516514
child = right;
517515
}
518-
let x = replace(&mut self.data[child], zeroed());
519-
ptr::write(&mut self.data[pos], x);
520-
pos = child;
521-
child = 2 * pos + 1;
516+
hole.move_to(child);
517+
child = 2 * hole.pos() + 1;
522518
}
523519

524-
ptr::write(&mut self.data[pos], new);
525-
self.sift_up(start, pos);
520+
pos = hole.pos;
526521
}
522+
self.sift_up(start, pos);
527523
}
528524

529525
fn sift_down(&mut self, pos: usize) {
@@ -554,6 +550,73 @@ impl<T: Ord> BinaryHeap<T> {
554550
pub fn clear(&mut self) { self.drain(); }
555551
}
556552

553+
/// Hole represents a hole in a slice i.e. an index without valid value
554+
/// (because it was moved from or duplicated).
555+
/// In drop, `Hole` will restore the slice by filling the hole
556+
/// position with the value that was originally removed.
557+
struct Hole<'a, T: 'a> {
558+
data: &'a mut [T],
559+
/// `elt` is always `Some` from new until drop.
560+
elt: Option<T>,
561+
pos: usize,
562+
}
563+
564+
impl<'a, T> Hole<'a, T> {
565+
/// Create a new Hole at index `pos`.
566+
fn new(data: &'a mut [T], pos: usize) -> Self {
567+
unsafe {
568+
let elt = ptr::read(&data[pos]);
569+
Hole {
570+
data: data,
571+
elt: Some(elt),
572+
pos: pos,
573+
}
574+
}
575+
}
576+
577+
#[inline(always)]
578+
fn pos(&self) -> usize { self.pos }
579+
580+
/// Return a reference to the element removed
581+
#[inline(always)]
582+
fn removed(&self) -> &T {
583+
self.elt.as_ref().unwrap()
584+
}
585+
586+
/// Return a reference to the element at `index`.
587+
///
588+
/// Panics if the index is out of bounds.
589+
///
590+
/// Unsafe because index must not equal pos.
591+
#[inline(always)]
592+
unsafe fn get(&self, index: usize) -> &T {
593+
debug_assert!(index != self.pos);
594+
&self.data[index]
595+
}
596+
597+
/// Move hole to new location
598+
///
599+
/// Unsafe because index must not equal pos.
600+
#[inline(always)]
601+
unsafe fn move_to(&mut self, index: usize) {
602+
debug_assert!(index != self.pos);
603+
let index_ptr: *const _ = &self.data[index];
604+
let hole_ptr = &mut self.data[self.pos];
605+
ptr::copy_nonoverlapping(index_ptr, hole_ptr, 1);
606+
self.pos = index;
607+
}
608+
}
609+
610+
impl<'a, T> Drop for Hole<'a, T> {
611+
fn drop(&mut self) {
612+
// fill the hole again
613+
unsafe {
614+
let pos = self.pos;
615+
ptr::write(&mut self.data[pos], self.elt.take().unwrap());
616+
}
617+
}
618+
}
619+
557620
/// `BinaryHeap` iterator.
558621
#[stable(feature = "rust1", since = "1.0.0")]
559622
pub struct Iter <'a, T: 'a> {

branches/auto/src/libcollections/fmt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@
164164
//! provides some helper methods.
165165
//!
166166
//! Additionally, the return value of this function is `fmt::Result` which is a
167-
//! typedef to `Result<(), IoError>` (also known as `IoResult<()>`). Formatting
168-
//! implementations should ensure that they return errors from `write!`
167+
//! typedef to `Result<(), std::io::Error>` (also known as `std::io::Result<()>`).
168+
//! Formatting implementations should ensure that they return errors from `write!`
169169
//! correctly (propagating errors upward).
170170
//!
171171
//! An example of implementing the formatting traits would look

branches/auto/src/libcollections/vec.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,14 +440,18 @@ impl<T> Vec<T> {
440440
}
441441

442442
/// Extracts a slice containing the entire vector.
443+
///
444+
/// Equivalent to `&s[..]`.
443445
#[inline]
444446
#[unstable(feature = "convert",
445447
reason = "waiting on RFC revision")]
446448
pub fn as_slice(&self) -> &[T] {
447449
self
448450
}
449451

450-
/// Deprecated: use `&mut s[..]` instead.
452+
/// Extracts a mutable slice of the entire vector.
453+
///
454+
/// Equivalent to `&mut s[..]`.
451455
#[inline]
452456
#[unstable(feature = "convert",
453457
reason = "waiting on RFC revision")]

branches/auto/src/libcollectionstest/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#![feature(collections)]
1515
#![feature(collections_drain)]
1616
#![feature(core)]
17+
#![feature(const_fn)]
1718
#![feature(hash)]
1819
#![feature(rand)]
1920
#![feature(rustc_private)]

0 commit comments

Comments
 (0)