Skip to content

Commit 2866cc5

Browse files
committed
---
yaml --- r: 156460 b: refs/heads/snap-stage3 c: 555ab2b h: refs/heads/master v: v3
1 parent 15713c1 commit 2866cc5

File tree

357 files changed

+12828
-1371
lines changed

Some content is hidden

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

357 files changed

+12828
-1371
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: c29a7520e7fb4a5b4d4eccfc594e05793ef6688d
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 7d0cc44f873ac338b400b20bcb62618aa5d36b70
4+
refs/heads/snap-stage3: 555ab2b3a4b25ea9285ca65350e248443f1945ac
55
refs/heads/try: 6601b0501e31d08d3892a2d5a7d8a57ab120bf75
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/mk/crates.mk

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@
4949
# automatically generated for all stage/host/target combinations.
5050
################################################################################
5151

52-
TARGET_CRATES := libc std green native flate arena term \
53-
serialize sync getopts collections test time rand \
54-
log regex graphviz core rbml rlibc alloc rustrt \
52+
TARGET_CRATES := libc std green native flate arena glob term semver \
53+
uuid serialize sync getopts collections num test time rand \
54+
url log regex graphviz core rbml rlibc alloc rustrt \
5555
unicode
56-
HOST_CRATES := syntax rustc rustdoc regex_macros fmt_macros \
56+
HOST_CRATES := syntax rustc rustdoc fourcc hexfloat regex_macros fmt_macros \
5757
rustc_llvm rustc_back
5858
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
5959
TOOLS := compiletest rustdoc rustc
@@ -83,13 +83,18 @@ DEPS_glob := std
8383
DEPS_serialize := std log
8484
DEPS_rbml := std log serialize
8585
DEPS_term := std log
86+
DEPS_semver := std
87+
DEPS_uuid := std serialize
8688
DEPS_sync := core alloc rustrt collections
8789
DEPS_getopts := std
8890
DEPS_collections := core alloc unicode
91+
DEPS_fourcc := rustc syntax std
92+
DEPS_hexfloat := rustc syntax std
8993
DEPS_num := std
9094
DEPS_test := std getopts serialize rbml term time regex native:rust_test_helpers
9195
DEPS_time := std serialize
9296
DEPS_rand := core
97+
DEPS_url := std
9398
DEPS_log := std regex
9499
DEPS_regex := std
95100
DEPS_regex_macros = rustc syntax std regex

branches/snap-stage3/src/doc/guide.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3095,10 +3095,10 @@ And try to run the test:
30953095

30963096
```{notrust,ignore}
30973097
$ cargo test
3098-
Compiling testing v0.0.1 (file:///home/you/projects/testing)
3099-
/home/you/projects/testing/tests/lib.rs:3:18: 3:38 error: unresolved name `add_three_times_four`.
3100-
/home/you/projects/testing/tests/lib.rs:3 let result = add_three_times_four(5i);
3101-
^~~~~~~~~~~~~~~~~~~~
3098+
Compiling testing v0.0.1 (file:///home/youg/projects/testing)
3099+
/home/youg/projects/testing/tests/lib.rs:3:18: 3:38 error: unresolved name `add_three_times_four`.
3100+
/home/youg/projects/testing/tests/lib.rs:3 let result = add_three_times_four(5i);
3101+
^~~~~~~~~~~~~~~~~~~~
31023102
error: aborting due to previous error
31033103
Build failed, waiting for other jobs to finish...
31043104
Could not compile `testing`.
@@ -3284,11 +3284,11 @@ Let's give it a shot:
32843284
$ cargo test
32853285
Compiling testing v0.0.1 (file:///home/you/projects/testing)
32863286
3287-
running 1 test
3287+
running 2 tests
32883288
test test::test_times_four ... ok
32893289
test test::test_add_three ... ok
32903290
3291-
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
3291+
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured
32923292
32933293
32943294
running 0 tests

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,12 @@ impl<T> DList<T> {
475475
Items{nelem: self.len(), head: &self.list_head, tail: self.list_tail}
476476
}
477477

478+
/// Deprecated: use `iter_mut`.
479+
#[deprecated = "use iter_mut"]
480+
pub fn mut_iter<'a>(&'a mut self) -> MutItems<'a, T> {
481+
self.iter_mut()
482+
}
483+
478484
/// Provides a forward iterator with mutable references.
479485
#[inline]
480486
pub fn iter_mut<'a>(&'a mut self) -> MutItems<'a, T> {
@@ -490,6 +496,12 @@ impl<T> DList<T> {
490496
}
491497
}
492498

499+
/// Deprecated: use `into_iter`.
500+
#[deprecated = "use into_iter"]
501+
pub fn move_iter(self) -> MoveItems<T> {
502+
self.into_iter()
503+
}
504+
493505
/// Consumes the list into an iterator yielding elements by value.
494506
#[inline]
495507
pub fn into_iter(self) -> MoveItems<T> {
@@ -858,8 +870,7 @@ mod tests {
858870
let mut m = list_from(v.as_slice());
859871
m.append(list_from(u.as_slice()));
860872
check_links(&m);
861-
let mut sum = v;
862-
sum.push_all(u.as_slice());
873+
let sum = v.append(u.as_slice());
863874
assert_eq!(sum.len(), m.len());
864875
for elt in sum.into_iter() {
865876
assert_eq!(m.pop_front(), Some(elt))

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,40 @@ pub trait Deque<T> : MutableSeq<T> {
502502
/// ```
503503
fn push_front(&mut self, elt: T);
504504

505+
/// Inserts an element last in the sequence.
506+
///
507+
/// # Example
508+
///
509+
/// ```ignore
510+
/// use std::collections::{DList, Deque};
511+
///
512+
/// let mut d = DList::new();
513+
/// d.push_back(1i);
514+
/// d.push_back(2i);
515+
/// assert_eq!(d.front(), Some(&1i));
516+
/// ```
517+
#[deprecated = "use the `push` method"]
518+
fn push_back(&mut self, elt: T) { self.push(elt) }
519+
520+
/// Removes the last element and returns it, or `None` if the sequence is
521+
/// empty.
522+
///
523+
/// # Example
524+
///
525+
/// ```ignore
526+
/// use std::collections::{RingBuf, Deque};
527+
///
528+
/// let mut d = RingBuf::new();
529+
/// d.push_back(1i);
530+
/// d.push_back(2i);
531+
///
532+
/// assert_eq!(d.pop_back(), Some(2i));
533+
/// assert_eq!(d.pop_back(), Some(1i));
534+
/// assert_eq!(d.pop_back(), None);
535+
/// ```
536+
#[deprecated = "use the `pop` method"]
537+
fn pop_back(&mut self) -> Option<T> { self.pop() }
538+
505539
/// Removes the first element and returns it, or `None` if the sequence is
506540
/// empty.
507541
///

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,9 @@ impl<T: Ord> PriorityQueue<T> {
269269
if self.is_empty() { None } else { Some(&self.data[0]) }
270270
}
271271

272+
#[deprecated="renamed to `top`"]
273+
pub fn maybe_top<'a>(&'a self) -> Option<&'a T> { self.top() }
274+
272275
/// Returns the number of elements the queue can hold without reallocating.
273276
///
274277
/// # Example
@@ -338,6 +341,9 @@ impl<T: Ord> PriorityQueue<T> {
338341
}
339342
}
340343

344+
#[deprecated="renamed to `pop`"]
345+
pub fn maybe_pop(&mut self) -> Option<T> { self.pop() }
346+
341347
/// Pushes an item onto the queue.
342348
///
343349
/// # Example
@@ -411,6 +417,14 @@ impl<T: Ord> PriorityQueue<T> {
411417
}
412418
}
413419

420+
#[allow(dead_code)]
421+
#[deprecated="renamed to `into_vec`"]
422+
fn to_vec(self) -> Vec<T> { self.into_vec() }
423+
424+
#[allow(dead_code)]
425+
#[deprecated="renamed to `into_sorted_vec`"]
426+
fn to_sorted_vec(self) -> Vec<T> { self.into_sorted_vec() }
427+
414428
/// Consumes the `PriorityQueue` and returns the underlying vector
415429
/// in arbitrary order.
416430
///

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

Lines changed: 66 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use core::cmp;
1919
use core::default::Default;
2020
use core::fmt;
2121
use core::iter;
22-
use core::slice;
2322
use std::hash::{Writer, Hash};
2423

2524
use {Deque, Mutable, MutableSeq};
@@ -133,6 +132,32 @@ impl<T> RingBuf<T> {
133132
elts: Vec::from_fn(cmp::max(MINIMUM_CAPACITY, n), |_| None)}
134133
}
135134

135+
/// Retrieve an element in the `RingBuf` by index.
136+
///
137+
/// Fails if there is no element with the given index.
138+
///
139+
/// # Example
140+
///
141+
/// ```rust
142+
/// #![allow(deprecated)]
143+
///
144+
/// use std::collections::RingBuf;
145+
///
146+
/// let mut buf = RingBuf::new();
147+
/// buf.push(3i);
148+
/// buf.push(4);
149+
/// buf.push(5);
150+
/// assert_eq!(buf.get(1), &4);
151+
/// ```
152+
#[deprecated = "prefer using indexing, e.g., ringbuf[0]"]
153+
pub fn get<'a>(&'a self, i: uint) -> &'a T {
154+
let idx = self.raw_index(i);
155+
match self.elts[idx] {
156+
None => fail!(),
157+
Some(ref v) => v
158+
}
159+
}
160+
136161
/// Retrieves an element in the `RingBuf` by index.
137162
///
138163
/// Fails if there is no element with the given index.
@@ -225,6 +250,12 @@ impl<T> RingBuf<T> {
225250
Items{index: 0, rindex: self.nelts, lo: self.lo, elts: self.elts.as_slice()}
226251
}
227252

253+
/// Deprecated: use `iter_mut`
254+
#[deprecated = "use iter_mut"]
255+
pub fn mut_iter<'a>(&'a mut self) -> MutItems<'a, T> {
256+
self.iter_mut()
257+
}
258+
228259
/// Returns a front-to-back iterator which returns mutable references.
229260
///
230261
/// # Example
@@ -254,20 +285,16 @@ impl<T> RingBuf<T> {
254285
// 0 to end_index
255286
let (temp, remaining1) = self.elts.split_at_mut(start_index);
256287
let (remaining2, _) = temp.split_at_mut(end_index);
257-
MutItems {
258-
remaining1: remaining1.iter_mut(),
259-
remaining2: remaining2.iter_mut(),
260-
nelts: self.nelts,
261-
}
288+
MutItems { remaining1: remaining1,
289+
remaining2: remaining2,
290+
nelts: self.nelts }
262291
} else {
263292
// Items to iterate goes from start_index to end_index:
264293
let (empty, elts) = self.elts.split_at_mut(0);
265294
let remaining1 = elts[mut start_index..end_index];
266-
MutItems {
267-
remaining1: remaining1.iter_mut(),
268-
remaining2: empty.iter_mut(),
269-
nelts: self.nelts,
270-
}
295+
MutItems { remaining1: remaining1,
296+
remaining2: empty,
297+
nelts: self.nelts }
271298
}
272299
}
273300
}
@@ -329,26 +356,26 @@ impl<'a, T> RandomAccessIterator<&'a T> for Items<'a, T> {
329356

330357
/// `RingBuf` mutable iterator.
331358
pub struct MutItems<'a, T:'a> {
332-
remaining1: slice::MutItems<'a, Option<T>>,
333-
remaining2: slice::MutItems<'a, Option<T>>,
359+
remaining1: &'a mut [Option<T>],
360+
remaining2: &'a mut [Option<T>],
334361
nelts: uint,
335362
}
336363

337364
impl<'a, T> Iterator<&'a mut T> for MutItems<'a, T> {
338365
#[inline]
366+
#[allow(deprecated)] // mut_shift_ref
339367
fn next(&mut self) -> Option<&'a mut T> {
340368
if self.nelts == 0 {
341369
return None;
342370
}
371+
let r = if self.remaining1.len() > 0 {
372+
&mut self.remaining1
373+
} else {
374+
assert!(self.remaining2.len() > 0);
375+
&mut self.remaining2
376+
};
343377
self.nelts -= 1;
344-
match self.remaining1.next() {
345-
Some(ptr) => return Some(ptr.as_mut().unwrap()),
346-
None => {}
347-
}
348-
match self.remaining2.next() {
349-
Some(ptr) => return Some(ptr.as_mut().unwrap()),
350-
None => unreachable!(),
351-
}
378+
Some(r.mut_shift_ref().unwrap().get_mut_ref())
352379
}
353380

354381
#[inline]
@@ -359,19 +386,19 @@ impl<'a, T> Iterator<&'a mut T> for MutItems<'a, T> {
359386

360387
impl<'a, T> DoubleEndedIterator<&'a mut T> for MutItems<'a, T> {
361388
#[inline]
389+
#[allow(deprecated)] // mut_shift_ref
362390
fn next_back(&mut self) -> Option<&'a mut T> {
363391
if self.nelts == 0 {
364392
return None;
365393
}
394+
let r = if self.remaining2.len() > 0 {
395+
&mut self.remaining2
396+
} else {
397+
assert!(self.remaining1.len() > 0);
398+
&mut self.remaining1
399+
};
366400
self.nelts -= 1;
367-
match self.remaining2.next_back() {
368-
Some(ptr) => return Some(ptr.as_mut().unwrap()),
369-
None => {}
370-
}
371-
match self.remaining1.next_back() {
372-
Some(ptr) => return Some(ptr.as_mut().unwrap()),
373-
None => unreachable!(),
374-
}
401+
Some(r.mut_pop_ref().unwrap().get_mut_ref())
375402
}
376403
}
377404

@@ -457,12 +484,9 @@ impl<S: Writer, A: Hash<S>> Hash<S> for RingBuf<A> {
457484

458485
impl<A> Index<uint, A> for RingBuf<A> {
459486
#[inline]
487+
#[allow(deprecated)]
460488
fn index<'a>(&'a self, i: &uint) -> &'a A {
461-
let idx = self.raw_index(*i);
462-
match self.elts[idx] {
463-
None => fail!(),
464-
Some(ref v) => v,
465-
}
489+
self.get(*i)
466490
}
467491
}
468492

@@ -552,14 +576,14 @@ mod tests {
552576
assert_eq!(d.len(), 3u);
553577
d.push_front(1);
554578
assert_eq!(d.len(), 4u);
555-
debug!("{}", d[0]);
556-
debug!("{}", d[1]);
557-
debug!("{}", d[2]);
558-
debug!("{}", d[3]);
559-
assert_eq!(d[0], 1);
560-
assert_eq!(d[1], 2);
561-
assert_eq!(d[2], 3);
562-
assert_eq!(d[3], 4);
579+
debug!("{}", d.get(0));
580+
debug!("{}", d.get(1));
581+
debug!("{}", d.get(2));
582+
debug!("{}", d.get(3));
583+
assert_eq!(*d.get(0), 1);
584+
assert_eq!(*d.get(1), 2);
585+
assert_eq!(*d.get(2), 3);
586+
assert_eq!(*d.get(3), 4);
563587
}
564588

565589
#[cfg(test)]

0 commit comments

Comments
 (0)