Skip to content

Commit 94c356d

Browse files
committed
---
yaml --- r: 162583 b: refs/heads/try c: f1f6c12 h: refs/heads/master i: 162581: 40f838e 162579: 28b7aa3 162575: 616be87 v: v3
1 parent 0b1fbd1 commit 94c356d

Some content is hidden

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

64 files changed

+1341
-2196
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 9146a919b616e39e528e4d7100d16eef52f1f852
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cafe2966770ff377aad6dd9fd808e68055587c58
5-
refs/heads/try: 0c1d853fba0068f9fd34b43a565ded01b199506c
5+
refs/heads/try: f1f6c1286f24f6f762a9b195ac678b55d20c9a9b
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/src/etc/emacs/rust-mode.el

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
(modify-syntax-entry ?\" "\"" table)
3232
(modify-syntax-entry ?\\ "\\" table)
3333

34+
;; _ is a word-char
35+
(modify-syntax-entry ?_ "w" table)
36+
3437
;; Comments
3538
(modify-syntax-entry ?/ ". 124b" table)
3639
(modify-syntax-entry ?* ". 23" table)
@@ -394,7 +397,7 @@ This is written mainly to be used as `beginning-of-defun-function' for Rust.
394397
Don't move to the beginning of the line. `beginning-of-defun',
395398
which calls this, does that afterwards."
396399
(interactive "p")
397-
(re-search-backward (concat "^\\(" rust-top-item-beg-re "\\)\\_>")
400+
(re-search-backward (concat "^\\(" rust-top-item-beg-re "\\)\\b")
398401
nil 'move (or arg 1)))
399402

400403
(defun rust-end-of-defun ()

branches/try/src/libcollections/binary_heap.rs

Lines changed: 3 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,9 @@ use core::mem::{zeroed, replace, swap};
160160
use core::ptr;
161161

162162
use slice;
163-
use vec::{mod, Vec};
163+
use vec::Vec;
164+
165+
// FIXME(conventions): implement into_iter
164166

165167
/// A priority queue implemented with a binary heap.
166168
///
@@ -241,27 +243,6 @@ impl<T: Ord> BinaryHeap<T> {
241243
Items { iter: self.data.iter() }
242244
}
243245

244-
/// Creates a consuming iterator, that is, one that moves each value out of
245-
/// the binary heap in arbitrary order. The binary heap cannot be used
246-
/// after calling this.
247-
///
248-
/// # Example
249-
///
250-
/// ```
251-
/// use std::collections::BinaryHeap;
252-
/// let pq = BinaryHeap::from_vec(vec![1i, 2, 3, 4]);
253-
///
254-
/// // Print 1, 2, 3, 4 in arbitrary order
255-
/// for x in pq.into_iter() {
256-
/// // x has type int, not &int
257-
/// println!("{}", x);
258-
/// }
259-
/// ```
260-
#[unstable = "matches collection reform specification, waiting for dust to settle"]
261-
pub fn into_iter(self) -> MoveItems<T> {
262-
MoveItems { iter: self.data.into_iter() }
263-
}
264-
265246
/// Returns the greatest item in a queue, or `None` if it is empty.
266247
///
267248
/// # Example
@@ -567,26 +548,6 @@ impl<'a, T> Iterator<&'a T> for Items<'a, T> {
567548
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
568549
}
569550

570-
/// An iterator that moves out of a `BinaryHeap`.
571-
pub struct MoveItems<T> {
572-
iter: vec::MoveItems<T>,
573-
}
574-
575-
impl<T> Iterator<T> for MoveItems<T> {
576-
#[inline]
577-
fn next(&mut self) -> Option<T> { self.iter.next() }
578-
579-
#[inline]
580-
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
581-
}
582-
583-
impl<T> DoubleEndedIterator<T> for MoveItems<T> {
584-
#[inline]
585-
fn next_back(&mut self) -> Option<T> { self.iter.next_back() }
586-
}
587-
588-
impl<T> ExactSize<T> for MoveItems<T> {}
589-
590551
impl<T: Ord> FromIterator<T> for BinaryHeap<T> {
591552
fn from_iter<Iter: Iterator<T>>(mut iter: Iter) -> BinaryHeap<T> {
592553
let vec: Vec<T> = iter.collect();
@@ -625,43 +586,6 @@ mod tests {
625586
}
626587
}
627588

628-
#[test]
629-
fn test_move_iter() {
630-
let data = vec!(5i, 9, 3);
631-
let iterout = vec!(9i, 5, 3);
632-
let pq = BinaryHeap::from_vec(data);
633-
634-
let v: Vec<int> = pq.into_iter().collect();
635-
assert_eq!(v, iterout);
636-
}
637-
638-
#[test]
639-
fn test_move_iter_size_hint() {
640-
let data = vec!(5i, 9);
641-
let pq = BinaryHeap::from_vec(data);
642-
643-
let mut it = pq.into_iter();
644-
645-
assert_eq!(it.size_hint(), (2, Some(2)));
646-
assert_eq!(it.next(), Some(9i));
647-
648-
assert_eq!(it.size_hint(), (1, Some(1)));
649-
assert_eq!(it.next(), Some(5i));
650-
651-
assert_eq!(it.size_hint(), (0, Some(0)));
652-
assert_eq!(it.next(), None);
653-
}
654-
655-
#[test]
656-
fn test_move_iter_reverse() {
657-
let data = vec!(5i, 9, 3);
658-
let iterout = vec!(3i, 5, 9);
659-
let pq = BinaryHeap::from_vec(data);
660-
661-
let v: Vec<int> = pq.into_iter().rev().collect();
662-
assert_eq!(v, iterout);
663-
}
664-
665589
#[test]
666590
fn test_top_and_pop() {
667591
let data = vec!(2u, 4, 6, 2, 1, 8, 10, 3, 5, 7, 0, 9, 1);

branches/try/src/libcollections/str.rs

Lines changed: 36 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ impl<S: Str> StrVector for [S] {
163163
}
164164
}
165165

166-
impl<S: Str, T: AsSlice<S>> StrVector for T {
166+
impl<S: Str> StrVector for Vec<S> {
167167
#[inline]
168168
fn concat(&self) -> String {
169169
self.as_slice().concat()
@@ -929,93 +929,54 @@ mod tests {
929929
assert_eq!("ะเทศไท", "ประเทศไทย中华Việt Nam".slice_chars(2, 8));
930930
}
931931

932-
struct S {
933-
x: [String, .. 2]
934-
}
935-
936-
impl AsSlice<String> for S {
937-
fn as_slice<'a> (&'a self) -> &'a [String] {
938-
&self.x
939-
}
940-
}
941-
942-
fn s(x: &str) -> String { x.into_string() }
943-
944-
macro_rules! test_concat {
945-
($expected: expr, $string: expr) => {
946-
{
947-
let s = $string.concat();
948-
assert_eq!($expected, s.as_slice());
949-
}
950-
}
951-
}
952-
953932
#[test]
954-
fn test_concat_for_different_types() {
955-
test_concat!("ab", ["a", "b"]);
956-
test_concat!("ab", [s("a"), s("b")]);
957-
test_concat!("ab", vec!["a", "b"]);
958-
test_concat!("ab", vec!["a", "b"].as_slice());
959-
test_concat!("ab", vec![s("a"), s("b")]);
960-
961-
let mut v0 = ["a", "b"];
962-
let mut v1 = [s("a"), s("b")];
963-
unsafe {
964-
use std::c_vec::CVec;
965-
966-
test_concat!("ab", CVec::new(v0.as_mut_ptr(), v0.len()));
967-
test_concat!("ab", CVec::new(v1.as_mut_ptr(), v1.len()));
933+
fn test_concat() {
934+
fn t(v: &[String], s: &str) {
935+
assert_eq!(v.concat().as_slice(), s);
968936
}
969-
970-
test_concat!("ab", S { x: [s("a"), s("b")] });
937+
t(&[String::from_str("you"), String::from_str("know"),
938+
String::from_str("I'm"),
939+
String::from_str("no"), String::from_str("good")],
940+
"youknowI'mnogood");
941+
let v: &[String] = &[];
942+
t(v, "");
943+
t(&[String::from_str("hi")], "hi");
971944
}
972945

973946
#[test]
974-
fn test_concat_for_different_lengths() {
975-
let empty: &[&str] = &[];
976-
test_concat!("", empty);
977-
test_concat!("a", ["a"]);
978-
test_concat!("ab", ["a", "b"]);
979-
test_concat!("abc", ["", "a", "bc"]);
980-
}
981-
982-
macro_rules! test_connect {
983-
($expected: expr, $string: expr, $delim: expr) => {
984-
{
985-
let s = $string.connect($delim);
986-
assert_eq!($expected, s.as_slice());
987-
}
947+
fn test_connect() {
948+
fn t(v: &[String], sep: &str, s: &str) {
949+
assert_eq!(v.connect(sep).as_slice(), s);
988950
}
951+
t(&[String::from_str("you"), String::from_str("know"),
952+
String::from_str("I'm"),
953+
String::from_str("no"), String::from_str("good")],
954+
" ", "you know I'm no good");
955+
let v: &[String] = &[];
956+
t(v, " ", "");
957+
t(&[String::from_str("hi")], " ", "hi");
989958
}
990959

991960
#[test]
992-
fn test_connect_for_different_types() {
993-
test_connect!("a-b", ["a", "b"], "-");
994-
let hyphen = "-".into_string();
995-
test_connect!("a-b", [s("a"), s("b")], hyphen.as_slice());
996-
test_connect!("a-b", vec!["a", "b"], hyphen.as_slice());
997-
test_connect!("a-b", vec!["a", "b"].as_slice(), "-");
998-
test_connect!("a-b", vec![s("a"), s("b")], "-");
999-
1000-
let mut v0 = ["a", "b"];
1001-
let mut v1 = [s("a"), s("b")];
1002-
unsafe {
1003-
use std::c_vec::CVec;
1004-
1005-
test_connect!("a-b", CVec::new(v0.as_mut_ptr(), v0.len()), "-");
1006-
test_connect!("a-b", CVec::new(v1.as_mut_ptr(), v1.len()), hyphen.as_slice());
961+
fn test_concat_slices() {
962+
fn t(v: &[&str], s: &str) {
963+
assert_eq!(v.concat().as_slice(), s);
1007964
}
1008-
1009-
test_connect!("a-b", S { x: [s("a"), s("b")] }, "-");
965+
t(&["you", "know", "I'm", "no", "good"], "youknowI'mnogood");
966+
let v: &[&str] = &[];
967+
t(v, "");
968+
t(&["hi"], "hi");
1010969
}
1011970

1012971
#[test]
1013-
fn test_connect_for_different_lengths() {
1014-
let empty: &[&str] = &[];
1015-
test_connect!("", empty, "-");
1016-
test_connect!("a", ["a"], "-");
1017-
test_connect!("a-b", ["a", "b"], "-");
1018-
test_connect!("-a-bc", ["", "a", "bc"], "-");
972+
fn test_connect_slices() {
973+
fn t(v: &[&str], sep: &str, s: &str) {
974+
assert_eq!(v.connect(sep).as_slice(), s);
975+
}
976+
t(&["you", "know", "I'm", "no", "good"],
977+
" ", "you know I'm no good");
978+
t(&[], " ", "");
979+
t(&["hi"], " ", "hi");
1019980
}
1020981

1021982
#[test]

branches/try/src/libcollections/vec.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1248,14 +1248,18 @@ pub struct MoveItems<T> {
12481248
impl<T> MoveItems<T> {
12491249
#[inline]
12501250
/// Drops all items that have not yet been moved and returns the empty vector.
1251-
pub fn unwrap(mut self) -> Vec<T> {
1251+
pub fn into_inner(mut self) -> Vec<T> {
12521252
unsafe {
12531253
for _x in self { }
12541254
let MoveItems { allocation, cap, ptr: _ptr, end: _end } = self;
12551255
mem::forget(self);
12561256
Vec { ptr: allocation, cap: cap, len: 0 }
12571257
}
12581258
}
1259+
1260+
/// Deprecated, use into_inner() instead
1261+
#[deprecated = "renamed to into_inner()"]
1262+
pub fn unwrap(self) -> Vec<T> { self.into_inner() }
12591263
}
12601264

12611265
impl<T> Iterator<T> for MoveItems<T> {

branches/try/src/libcore/any.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ use intrinsics::TypeId;
8888
#[stable]
8989
pub trait Any: 'static {
9090
/// Get the `TypeId` of `self`
91-
#[experimental = "this method will likely be replaced by an associated static"]
91+
#[stable]
9292
fn get_type_id(&self) -> TypeId;
9393
}
9494

branches/try/src/libcore/cell.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,15 +256,19 @@ impl<T> RefCell<T> {
256256
}
257257

258258
/// Consumes the `RefCell`, returning the wrapped value.
259-
#[unstable = "may be renamed, depending on global conventions"]
260-
pub fn unwrap(self) -> T {
259+
#[unstable = "recently renamed per RFC 430"]
260+
pub fn into_inner(self) -> T {
261261
// Since this function takes `self` (the `RefCell`) by value, the
262262
// compiler statically verifies that it is not currently borrowed.
263263
// Therefore the following assertion is just a `debug_assert!`.
264264
debug_assert!(self.borrow.get() == UNUSED);
265-
unsafe{self.value.unwrap()}
265+
unsafe { self.value.into_inner() }
266266
}
267267

268+
/// Deprecated, use into_inner() instead
269+
#[deprecated = "renamed to into_inner()"]
270+
pub fn unwrap(self) -> T { self.into_inner() }
271+
268272
/// Attempts to immutably borrow the wrapped value.
269273
///
270274
/// The borrow lasts until the returned `Ref` exits scope. Multiple
@@ -518,5 +522,9 @@ impl<T> UnsafeCell<T> {
518522
#[inline]
519523
#[unstable = "conventions around the name `unwrap` are still under \
520524
development"]
521-
pub unsafe fn unwrap(self) -> T { self.value }
525+
pub unsafe fn into_inner(self) -> T { self.value }
526+
527+
/// Deprecated, use into_inner() instead
528+
#[deprecated = "renamed to into_inner()"]
529+
pub unsafe fn unwrap(self) -> T { self.into_inner() }
522530
}

0 commit comments

Comments
 (0)