Skip to content

Commit d960a45

Browse files
committed
---
yaml --- r: 277231 b: refs/heads/try c: f089cf9 h: refs/heads/master i: 277229: 2bf306c 277227: 1b72986 277223: dd61a6a 277215: 3fee18b
1 parent dfa71fe commit d960a45

File tree

93 files changed

+561
-1477
lines changed

Some content is hidden

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

93 files changed

+561
-1477
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: 6dbb0e86aec11050480beb76eade6fb805010ba7
33
refs/heads/snap-stage3: 235d77457d80b549dad3ac36d94f235208a1eafb
4-
refs/heads/try: 31374d8030a30803d018c7a70b70e59030713adb
4+
refs/heads/try: f089cf9b2ff2602edd989480b7cd9d4b8b820f84
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ are:
307307
[gsearchdocs]: https://www.google.com/search?q=site:doc.rust-lang.org+your+query+here
308308
[rif]: http://internals.rust-lang.org
309309
[rr]: https://doc.rust-lang.org/book/README.html
310-
[tlgba]: http://tomlee.co/2014/04/a-more-detailed-tour-of-the-rust-compiler/
310+
[tlgba]: http://tomlee.co/2014/04/03/a-more-detailed-tour-of-the-rust-compiler/
311311
[ro]: http://www.rustaceans.org/
312312
[rctd]: ./COMPILER_TESTS.md
313313
[cheatsheet]: http://buildbot.rust-lang.org/homu/

branches/try/RELEASES.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ Cargo
140140
Performance
141141
-----------
142142

143-
* [The time complexity of comparing variables for equivalence during type
144-
unification is reduced from _O_(_n_!) to _O_(_n_)][1.9tu]. This leads
145-
to major compilation time improvement in some scenarios.
143+
* [During type unification, the complexity of comparing variables for
144+
equivalance was reduced from `O(n!)` to `O(n)`][1.9tu]. This leads
145+
to major compile-time improvements in some scenarios.
146146
* [`ToString` is specialized for `str`, giving it the same performance
147147
as `to_owned`][1.9ts].
148148
* [Spawning processes with `Command::output` no longer creates extra

branches/try/src/doc/book/casting-between-types.md

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,10 @@ Rust lets us:
165165
```rust
166166
use std::mem;
167167

168-
fn main() {
169-
unsafe {
170-
let a = [0u8, 1u8, 0u8, 0u8];
171-
let b = mem::transmute::<[u8; 4], u32>(a);
172-
println!("{}", b); // 256
173-
// or, more concisely:
174-
let c: u32 = mem::transmute(a);
175-
println!("{}", c); // 256
176-
}
168+
unsafe {
169+
let a = [0u8, 0u8, 0u8, 0u8];
170+
171+
let b = mem::transmute::<[u8; 4], u32>(a);
177172
}
178173
```
179174

branches/try/src/doc/book/mutability.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,18 @@ changed from one `i32` to another.
2424

2525
[vb]: variable-bindings.html
2626

27-
You can also create a [reference][ref] to it, using `&x`, but if you want to use the reference to change it, you will need a mutable reference:
27+
If you want to change what the binding points to, you’ll need a [mutable reference][mr]:
2828

2929
```rust
3030
let mut x = 5;
3131
let y = &mut x;
3232
```
3333

34-
[ref]: references-and-borrowing.html
34+
[mr]: references-and-borrowing.html
3535

36-
`y` is an immutable binding to a mutable reference, which means that you can’t bind 'y' to something else (`y = &mut z`), but `y` can be used to bind `x` to something else (`*y = 5`). A subtle distinction.
36+
`y` is an immutable binding to a mutable reference, which means that you can’t
37+
bind `y` to something else (`y = &mut z`), but you can mutate the thing that’s
38+
bound to `y` (`*y = 5`). A subtle distinction.
3739

3840
Of course, if you need both:
3941

branches/try/src/doc/book/ownership.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,11 @@ For example if we truncated the vector to just two elements through `v2`:
173173
v2.truncate(2);
174174
```
175175

176-
and `v` were still accessible we'd end up with an invalid vector since `v`
176+
and `v1` were still accessible we'd end up with an invalid vector since `v1`
177177
would not know that the heap data has been truncated. Now, the part of the
178-
vector `v` on the stack does not agree with the corresponding part on the
179-
heap. `v` still thinks there are three elements in the vector and will
180-
happily let us access the non existent element `v[2]` but as you might
178+
vector `v1` on the stack does not agree with the corresponding part on the
179+
heap. `v1` still thinks there are three elements in the vector and will
180+
happily let us access the non existent element `v1[2]` but as you might
181181
already know this is a recipe for disaster. Especially because it might lead
182182
to a segmentation fault or worse allow an unauthorized user to read from
183183
memory to which they don't have access.

branches/try/src/doc/book/primitive-types.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,9 @@ and `i64` is a signed, 64-bit integer.
9797

9898
## Variable-size types
9999

100-
Rust also provides types whose particular size depends on the underlying machine
101-
architecture. Their range is sufficient to express the size of any collection, so
102-
these types have ‘size’ as the category. They come in signed and unsigned varieties
103-
which account for two types: `isize` and `usize`.
100+
Rust also provides types whose size depends on the size of a pointer of the
101+
underlying machine. These types have ‘size’ as the category, and come in signed
102+
and unsigned varieties. This makes for two types: `isize` and `usize`.
104103

105104
## Floating-point types
106105

branches/try/src/libcollections/binary_heap.rs

Lines changed: 5 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -153,15 +153,12 @@
153153

154154
use core::iter::FromIterator;
155155
use core::mem::swap;
156-
use core::mem::size_of;
157156
use core::ptr;
158157
use core::fmt;
159158

160159
use slice;
161160
use vec::{self, Vec};
162161

163-
use super::SpecExtend;
164-
165162
/// A priority queue implemented with a binary heap.
166163
///
167164
/// This will be a max-heap.
@@ -741,71 +738,6 @@ impl<T: Ord> BinaryHeap<T> {
741738
pub fn clear(&mut self) {
742739
self.drain();
743740
}
744-
745-
fn rebuild(&mut self) {
746-
let mut n = self.len() / 2;
747-
while n > 0 {
748-
n -= 1;
749-
self.sift_down(n);
750-
}
751-
}
752-
753-
/// Moves all the elements of `other` into `self`, leaving `other` empty.
754-
///
755-
/// # Examples
756-
///
757-
/// Basic usage:
758-
///
759-
/// ```
760-
/// #![feature(binary_heap_append)]
761-
///
762-
/// use std::collections::BinaryHeap;
763-
///
764-
/// let v = vec![-10, 1, 2, 3, 3];
765-
/// let mut a = BinaryHeap::from(v);
766-
///
767-
/// let v = vec![-20, 5, 43];
768-
/// let mut b = BinaryHeap::from(v);
769-
///
770-
/// a.append(&mut b);
771-
///
772-
/// assert_eq!(a.into_sorted_vec(), [-20, -10, 1, 2, 3, 3, 5, 43]);
773-
/// assert!(b.is_empty());
774-
/// ```
775-
#[unstable(feature = "binary_heap_append",
776-
reason = "needs to be audited",
777-
issue = "32526")]
778-
pub fn append(&mut self, other: &mut Self) {
779-
if self.len() < other.len() {
780-
swap(self, other);
781-
}
782-
783-
if other.is_empty() {
784-
return;
785-
}
786-
787-
#[inline(always)]
788-
fn log2_fast(x: usize) -> usize {
789-
8 * size_of::<usize>() - (x.leading_zeros() as usize) - 1
790-
}
791-
792-
// `rebuild` takes O(len1 + len2) operations
793-
// and about 2 * (len1 + len2) comparisons in the worst case
794-
// while `extend` takes O(len2 * log_2(len1)) operations
795-
// and about 1 * len2 * log_2(len1) comparisons in the worst case,
796-
// assuming len1 >= len2.
797-
#[inline]
798-
fn better_to_rebuild(len1: usize, len2: usize) -> bool {
799-
2 * (len1 + len2) < len2 * log2_fast(len1)
800-
}
801-
802-
if better_to_rebuild(self.len(), other.len()) {
803-
self.data.append(&mut other.data);
804-
self.rebuild();
805-
} else {
806-
self.extend(other.drain());
807-
}
808-
}
809741
}
810742

811743
/// Hole represents a hole in a slice i.e. an index without valid value
@@ -919,7 +851,6 @@ impl<'a, T> ExactSizeIterator for Iter<'a, T> {}
919851

920852
/// An iterator that moves out of a `BinaryHeap`.
921853
#[stable(feature = "rust1", since = "1.0.0")]
922-
#[derive(Clone)]
923854
pub struct IntoIter<T> {
924855
iter: vec::IntoIter<T>,
925856
}
@@ -986,7 +917,11 @@ impl<'a, T: 'a> ExactSizeIterator for Drain<'a, T> {}
986917
impl<T: Ord> From<Vec<T>> for BinaryHeap<T> {
987918
fn from(vec: Vec<T>) -> BinaryHeap<T> {
988919
let mut heap = BinaryHeap { data: vec };
989-
heap.rebuild();
920+
let mut n = heap.len() / 2;
921+
while n > 0 {
922+
n -= 1;
923+
heap.sift_down(n);
924+
}
990925
heap
991926
}
992927
}
@@ -1045,26 +980,7 @@ impl<'a, T> IntoIterator for &'a BinaryHeap<T> where T: Ord {
1045980

1046981
#[stable(feature = "rust1", since = "1.0.0")]
1047982
impl<T: Ord> Extend<T> for BinaryHeap<T> {
1048-
#[inline]
1049983
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I) {
1050-
<Self as SpecExtend<I>>::spec_extend(self, iter);
1051-
}
1052-
}
1053-
1054-
impl<T: Ord, I: IntoIterator<Item = T>> SpecExtend<I> for BinaryHeap<T> {
1055-
default fn spec_extend(&mut self, iter: I) {
1056-
self.extend_desugared(iter.into_iter());
1057-
}
1058-
}
1059-
1060-
impl<T: Ord> SpecExtend<BinaryHeap<T>> for BinaryHeap<T> {
1061-
fn spec_extend(&mut self, ref mut other: BinaryHeap<T>) {
1062-
self.append(other);
1063-
}
1064-
}
1065-
1066-
impl<T: Ord> BinaryHeap<T> {
1067-
fn extend_desugared<I: IntoIterator<Item = T>>(&mut self, iter: I) {
1068984
let iterator = iter.into_iter();
1069985
let (lower, _) = iterator.size_hint();
1070986

0 commit comments

Comments
 (0)