Skip to content

Commit e2b53c3

Browse files
committed
---
yaml --- r: 158173 b: refs/heads/master c: 4e35289 h: refs/heads/master i: 158171: b86d1df v: v3
1 parent 0e82245 commit e2b53c3

File tree

181 files changed

+2150
-2761
lines changed

Some content is hidden

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

181 files changed

+2150
-2761
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 08ddfc10e4170ac5f4522a71c0d1aea8cf799f29
2+
refs/heads/master: 4e352892c8ca76f49332fb74d9903677dea2c5fe
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 1b2ad7831f1745bf4a4709a1fa1772afb47c933c
55
refs/heads/try: 98bd84a3300f974f400a3eeb56567ad3f77b13f0

trunk/src/doc/reference.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1961,10 +1961,8 @@ On an `extern` block, the following attributes are interpreted:
19611961
name and type. This is feature gated and the exact behavior is
19621962
implementation-defined (due to variety of linker invocation syntax).
19631963
- `link` - indicate that a native library should be linked to for the
1964-
declarations in this block to be linked correctly. `link` supports an optional `kind`
1965-
key with three possible values: `dylib`, `static`, and `framework`. See [external blocks](#external-blocks) for more about external blocks. Two
1966-
examples: `#[link(name = "readline")]` and
1967-
`#[link(name = "CoreFoundation", kind = "framework")]`.
1964+
declarations in this block to be linked correctly. See [external
1965+
blocks](#external-blocks)
19681966

19691967
On declarations inside an `extern` block, the following attributes are
19701968
interpreted:

trunk/src/etc/unicode.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def emit_bsearch_range_table(f):
293293
f.write("""
294294
fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool {
295295
use core::cmp::{Equal, Less, Greater};
296-
use core::slice::SlicePrelude;
296+
use core::slice::ImmutableSlice;
297297
r.binary_search(|&(lo,hi)| {
298298
if lo <= c && c <= hi { Equal }
299299
else if hi < c { Less }
@@ -351,7 +351,7 @@ def emit_conversions_module(f, lowerupper, upperlower):
351351
f.write("pub mod conversions {")
352352
f.write("""
353353
use core::cmp::{Equal, Less, Greater};
354-
use core::slice::SlicePrelude;
354+
use core::slice::ImmutableSlice;
355355
use core::tuple::Tuple2;
356356
use core::option::{Option, Some, None};
357357
use core::slice;
@@ -390,7 +390,7 @@ def emit_conversions_module(f, lowerupper, upperlower):
390390

391391
def emit_grapheme_module(f, grapheme_table, grapheme_cats):
392392
f.write("""pub mod grapheme {
393-
use core::slice::SlicePrelude;
393+
use core::slice::ImmutableSlice;
394394
use core::slice;
395395
396396
#[allow(non_camel_case_types)]
@@ -430,7 +430,7 @@ def emit_grapheme_module(f, grapheme_table, grapheme_cats):
430430
def emit_charwidth_module(f, width_table):
431431
f.write("pub mod charwidth {\n")
432432
f.write(" use core::option::{Option, Some, None};\n")
433-
f.write(" use core::slice::SlicePrelude;\n")
433+
f.write(" use core::slice::ImmutableSlice;\n")
434434
f.write(" use core::slice;\n")
435435
f.write("""
436436
fn bsearch_range_value_table(c: char, is_cjk: bool, r: &'static [(char, char, u8, u8)]) -> u8 {
@@ -530,7 +530,7 @@ def comp_pfun(char):
530530
f.write("""
531531
fn bsearch_range_value_table(c: char, r: &'static [(char, char, u8)]) -> u8 {
532532
use core::cmp::{Equal, Less, Greater};
533-
use core::slice::SlicePrelude;
533+
use core::slice::ImmutableSlice;
534534
use core::slice;
535535
match r.binary_search(|&(lo, hi, _)| {
536536
if lo <= c && c <= hi { Equal }

trunk/src/libcollections/binary_heap.rs

Lines changed: 10 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,6 @@ use core::ptr;
162162
use slice;
163163
use vec::Vec;
164164

165-
// FIXME(conventions): implement into_iter
166-
167165
/// A priority queue implemented with a binary heap.
168166
///
169167
/// This will be a max-heap.
@@ -186,7 +184,6 @@ impl<T: Ord> BinaryHeap<T> {
186184
/// use std::collections::BinaryHeap;
187185
/// let pq: BinaryHeap<uint> = BinaryHeap::new();
188186
/// ```
189-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
190187
pub fn new() -> BinaryHeap<T> { BinaryHeap{data: vec!(),} }
191188

192189
/// Creates an empty `BinaryHeap` with a specific capacity.
@@ -200,7 +197,6 @@ impl<T: Ord> BinaryHeap<T> {
200197
/// use std::collections::BinaryHeap;
201198
/// let pq: BinaryHeap<uint> = BinaryHeap::with_capacity(10u);
202199
/// ```
203-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
204200
pub fn with_capacity(capacity: uint) -> BinaryHeap<T> {
205201
BinaryHeap { data: Vec::with_capacity(capacity) }
206202
}
@@ -238,7 +234,6 @@ impl<T: Ord> BinaryHeap<T> {
238234
/// println!("{}", x);
239235
/// }
240236
/// ```
241-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
242237
pub fn iter<'a>(&'a self) -> Items<'a, T> {
243238
Items { iter: self.data.iter() }
244239
}
@@ -273,19 +268,10 @@ impl<T: Ord> BinaryHeap<T> {
273268
/// let pq: BinaryHeap<uint> = BinaryHeap::with_capacity(100u);
274269
/// assert!(pq.capacity() >= 100u);
275270
/// ```
276-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
277271
pub fn capacity(&self) -> uint { self.data.capacity() }
278272

279-
/// Reserves the minimum capacity for exactly `additional` more elements to be inserted in the
280-
/// given `BinaryHeap`. Does nothing if the capacity is already sufficient.
281-
///
282-
/// Note that the allocator may give the collection more space than it requests. Therefore
283-
/// capacity can not be relied upon to be precisely minimal. Prefer `reserve` if future
284-
/// insertions are expected.
285-
///
286-
/// # Panics
287-
///
288-
/// Panics if the new capacity overflows `uint`.
273+
/// Reserves capacity for exactly `n` elements in the `BinaryHeap`.
274+
/// Do nothing if the capacity is already sufficient.
289275
///
290276
/// # Example
291277
///
@@ -294,17 +280,12 @@ impl<T: Ord> BinaryHeap<T> {
294280
///
295281
/// let mut pq: BinaryHeap<uint> = BinaryHeap::new();
296282
/// pq.reserve_exact(100u);
297-
/// assert!(pq.capacity() >= 100u);
283+
/// assert!(pq.capacity() == 100u);
298284
/// ```
299-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
300-
pub fn reserve_exact(&mut self, additional: uint) { self.data.reserve_exact(additional) }
285+
pub fn reserve_exact(&mut self, n: uint) { self.data.reserve_exact(n) }
301286

302-
/// Reserves capacity for at least `additional` more elements to be inserted in the
303-
/// `BinaryHeap`. The collection may reserve more space to avoid frequent reallocations.
304-
///
305-
/// # Panics
306-
///
307-
/// Panics if the new capacity overflows `uint`.
287+
/// Reserves capacity for at least `n` elements in the `BinaryHeap`.
288+
/// Do nothing if the capacity is already sufficient.
308289
///
309290
/// # Example
310291
///
@@ -315,15 +296,8 @@ impl<T: Ord> BinaryHeap<T> {
315296
/// pq.reserve(100u);
316297
/// assert!(pq.capacity() >= 100u);
317298
/// ```
318-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
319-
pub fn reserve(&mut self, additional: uint) {
320-
self.data.reserve(additional)
321-
}
322-
323-
/// Discards as much additional capacity as possible.
324-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
325-
pub fn shrink_to_fit(&mut self) {
326-
self.data.shrink_to_fit()
299+
pub fn reserve(&mut self, n: uint) {
300+
self.data.reserve(n)
327301
}
328302

329303
/// Removes the greatest item from a queue and returns it, or `None` if it
@@ -340,7 +314,6 @@ impl<T: Ord> BinaryHeap<T> {
340314
/// assert_eq!(pq.pop(), Some(1i));
341315
/// assert_eq!(pq.pop(), None);
342316
/// ```
343-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
344317
pub fn pop(&mut self) -> Option<T> {
345318
match self.data.pop() {
346319
None => { None }
@@ -369,7 +342,6 @@ impl<T: Ord> BinaryHeap<T> {
369342
/// assert_eq!(pq.len(), 3);
370343
/// assert_eq!(pq.top(), Some(&5i));
371344
/// ```
372-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
373345
pub fn push(&mut self, item: T) {
374346
self.data.push(item);
375347
let new_len = self.len() - 1;
@@ -523,15 +495,12 @@ impl<T: Ord> BinaryHeap<T> {
523495
}
524496

525497
/// Returns the length of the queue.
526-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
527498
pub fn len(&self) -> uint { self.data.len() }
528499

529500
/// Returns true if the queue contains no elements
530-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
531501
pub fn is_empty(&self) -> bool { self.len() == 0 }
532502

533503
/// Drops all items from the queue.
534-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
535504
pub fn clear(&mut self) { self.data.truncate(0) }
536505
}
537506

@@ -559,7 +528,8 @@ impl<T: Ord> Extendable<T> for BinaryHeap<T> {
559528
fn extend<Iter: Iterator<T>>(&mut self, mut iter: Iter) {
560529
let (lower, _) = iter.size_hint();
561530

562-
self.reserve(lower);
531+
let len = self.capacity();
532+
self.reserve(len + lower);
563533

564534
for elem in iter {
565535
self.push(elem);

trunk/src/libcollections/bit.rs

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ use std::hash;
7575

7676
use vec::Vec;
7777

78-
// FIXME(conventions): look, we just need to refactor this whole thing. Inside and out.
79-
8078
type MatchWords<'a> = Chain<MaskWords<'a>, Skip<Take<Enumerate<Repeat<u32>>>>>;
8179
// Take two BitV's, and return iterators of their words, where the shorter one
8280
// has been padded with 0's
@@ -218,7 +216,6 @@ impl Bitv {
218216
/// use std::collections::Bitv;
219217
/// let mut bv = Bitv::new();
220218
/// ```
221-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
222219
pub fn new() -> Bitv {
223220
Bitv { storage: Vec::new(), nbits: 0 }
224221
}
@@ -616,7 +613,6 @@ impl Bitv {
616613
/// bv.truncate(2);
617614
/// assert!(bv.eq_vec([false, true]));
618615
/// ```
619-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
620616
pub fn truncate(&mut self, len: uint) {
621617
if len < self.len() {
622618
self.nbits = len;
@@ -764,17 +760,14 @@ impl Bitv {
764760

765761
/// Return the total number of bits in this vector
766762
#[inline]
767-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
768763
pub fn len(&self) -> uint { self.nbits }
769764

770765
/// Returns true if there are no bits in this vector
771766
#[inline]
772-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
773767
pub fn is_empty(&self) -> bool { self.len() == 0 }
774768

775769
/// Clears all bits in this vector.
776770
#[inline]
777-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
778771
pub fn clear(&mut self) {
779772
for w in self.storage.iter_mut() { *w = 0u32; }
780773
}
@@ -856,7 +849,8 @@ impl Clone for Bitv {
856849
#[inline]
857850
fn clone_from(&mut self, source: &Bitv) {
858851
self.nbits = source.nbits;
859-
self.storage.clone_from(&source.storage);
852+
self.storage.reserve(source.storage.len());
853+
for (i, w) in self.storage.iter_mut().enumerate() { *w = source.storage[i]; }
860854
}
861855
}
862856

@@ -1058,7 +1052,6 @@ impl BitvSet {
10581052
/// let mut s = BitvSet::new();
10591053
/// ```
10601054
#[inline]
1061-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
10621055
pub fn new() -> BitvSet {
10631056
BitvSet(Bitv::new())
10641057
}
@@ -1074,7 +1067,6 @@ impl BitvSet {
10741067
/// assert!(s.capacity() >= 100);
10751068
/// ```
10761069
#[inline]
1077-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
10781070
pub fn with_capacity(nbits: uint) -> BitvSet {
10791071
let bitv = Bitv::with_capacity(nbits, false);
10801072
BitvSet::from_bitv(bitv)
@@ -1114,7 +1106,6 @@ impl BitvSet {
11141106
/// assert!(s.capacity() >= 100);
11151107
/// ```
11161108
#[inline]
1117-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
11181109
pub fn capacity(&self) -> uint {
11191110
let &BitvSet(ref bitv) = self;
11201111
bitv.capacity()
@@ -1221,7 +1212,6 @@ impl BitvSet {
12211212
/// println!("new capacity: {}", s.capacity());
12221213
/// ```
12231214
#[inline]
1224-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
12251215
pub fn shrink_to_fit(&mut self) {
12261216
let &BitvSet(ref mut bitv) = self;
12271217
// Obtain original length
@@ -1250,7 +1240,6 @@ impl BitvSet {
12501240
/// }
12511241
/// ```
12521242
#[inline]
1253-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
12541243
pub fn iter<'a>(&'a self) -> BitPositions<'a> {
12551244
BitPositions {set: self, next_idx: 0u}
12561245
}
@@ -1273,7 +1262,6 @@ impl BitvSet {
12731262
/// }
12741263
/// ```
12751264
#[inline]
1276-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
12771265
pub fn union<'a>(&'a self, other: &'a BitvSet) -> TwoBitPositions<'a> {
12781266
TwoBitPositions {
12791267
set: self,
@@ -1302,7 +1290,6 @@ impl BitvSet {
13021290
/// }
13031291
/// ```
13041292
#[inline]
1305-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
13061293
pub fn intersection<'a>(&'a self, other: &'a BitvSet) -> Take<TwoBitPositions<'a>> {
13071294
let min = cmp::min(self.capacity(), other.capacity());
13081295
TwoBitPositions {
@@ -1339,7 +1326,6 @@ impl BitvSet {
13391326
/// }
13401327
/// ```
13411328
#[inline]
1342-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
13431329
pub fn difference<'a>(&'a self, other: &'a BitvSet) -> TwoBitPositions<'a> {
13441330
TwoBitPositions {
13451331
set: self,
@@ -1369,7 +1355,6 @@ impl BitvSet {
13691355
/// }
13701356
/// ```
13711357
#[inline]
1372-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
13731358
pub fn symmetric_difference<'a>(&'a self, other: &'a BitvSet) -> TwoBitPositions<'a> {
13741359
TwoBitPositions {
13751360
set: self,
@@ -1488,31 +1473,27 @@ impl BitvSet {
14881473

14891474
/// Return the number of set bits in this set.
14901475
#[inline]
1491-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
14921476
pub fn len(&self) -> uint {
14931477
let &BitvSet(ref bitv) = self;
14941478
bitv.storage.iter().fold(0, |acc, &n| acc + n.count_ones())
14951479
}
14961480

14971481
/// Returns whether there are no bits set in this set
14981482
#[inline]
1499-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
15001483
pub fn is_empty(&self) -> bool {
15011484
let &BitvSet(ref bitv) = self;
15021485
bitv.storage.iter().all(|&n| n == 0)
15031486
}
15041487

15051488
/// Clears all bits in this set
15061489
#[inline]
1507-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
15081490
pub fn clear(&mut self) {
15091491
let &BitvSet(ref mut bitv) = self;
15101492
bitv.clear();
15111493
}
15121494

15131495
/// Returns `true` if this set contains the specified integer.
15141496
#[inline]
1515-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
15161497
pub fn contains(&self, value: &uint) -> bool {
15171498
let &BitvSet(ref bitv) = self;
15181499
*value < bitv.nbits && bitv.get(*value)
@@ -1521,14 +1502,12 @@ impl BitvSet {
15211502
/// Returns `true` if the set has no elements in common with `other`.
15221503
/// This is equivalent to checking for an empty intersection.
15231504
#[inline]
1524-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
15251505
pub fn is_disjoint(&self, other: &BitvSet) -> bool {
15261506
self.intersection(other).next().is_none()
15271507
}
15281508

15291509
/// Returns `true` if the set is a subset of another.
15301510
#[inline]
1531-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
15321511
pub fn is_subset(&self, other: &BitvSet) -> bool {
15331512
let &BitvSet(ref self_bitv) = self;
15341513
let &BitvSet(ref other_bitv) = other;
@@ -1542,14 +1521,12 @@ impl BitvSet {
15421521

15431522
/// Returns `true` if the set is a superset of another.
15441523
#[inline]
1545-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
15461524
pub fn is_superset(&self, other: &BitvSet) -> bool {
15471525
other.is_subset(self)
15481526
}
15491527

15501528
/// Adds a value to the set. Returns `true` if the value was not already
15511529
/// present in the set.
1552-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
15531530
pub fn insert(&mut self, value: uint) -> bool {
15541531
if self.contains(&value) {
15551532
return false;
@@ -1568,7 +1545,6 @@ impl BitvSet {
15681545

15691546
/// Removes a value from the set. Returns `true` if the value was
15701547
/// present in the set.
1571-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
15721548
pub fn remove(&mut self, value: &uint) -> bool {
15731549
if !self.contains(value) {
15741550
return false;

0 commit comments

Comments
 (0)