Skip to content

Commit 52ef462

Browse files
committed
Rebasing changes
1 parent 3e62637 commit 52ef462

Some content is hidden

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

80 files changed

+851
-487
lines changed

src/libcollections/ringbuf.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,8 @@ impl<T> RingBuf<T> {
243243
/// buf.push(5i);
244244
/// buf.push(3);
245245
/// buf.push(4);
246-
/// assert_eq!(buf.iter().collect::<Vec<&int>>().as_slice(), &[&5, &3, &4]);
246+
/// let b: &[_] = &[&5, &3, &4];
247+
/// assert_eq!(buf.iter().collect::<Vec<&int>>().as_slice(), b);
247248
/// ```
248249
pub fn iter<'a>(&'a self) -> Items<'a, T> {
249250
Items{index: 0, rindex: self.nelts, lo: self.lo, elts: self.elts.as_slice()}
@@ -263,7 +264,8 @@ impl<T> RingBuf<T> {
263264
/// for num in buf.mut_iter() {
264265
/// *num = *num - 2;
265266
/// }
266-
/// assert_eq!(buf.mut_iter().collect::<Vec<&mut int>>().as_slice(), &[&mut 3, &mut 1, &mut 2]);
267+
/// let b: &[_] = &[&mut 3, &mut 1, &mut 2];
268+
/// assert_eq!(buf.mut_iter().collect::<Vec<&mut int>>().as_slice(), b);
267269
/// ```
268270
pub fn mut_iter<'a>(&'a mut self) -> MutItems<'a, T> {
269271
let start_index = raw_index(self.lo, self.elts.len(), 0);

src/libcollections/str.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1971,7 +1971,7 @@ mod tests {
19711971
use std::iter::order;
19721972
// official Unicode test data
19731973
// from http://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakTest.txt
1974-
let test_same = [
1974+
let test_same: [(_, &[_]), .. 325] = [
19751975
("\u0020\u0020", &["\u0020", "\u0020"]), ("\u0020\u0308\u0020", &["\u0020\u0308",
19761976
"\u0020"]), ("\u0020\u000D", &["\u0020", "\u000D"]), ("\u0020\u0308\u000D",
19771977
&["\u0020\u0308", "\u000D"]), ("\u0020\u000A", &["\u0020", "\u000A"]),
@@ -2180,7 +2180,7 @@ mod tests {
21802180
("\u0646\u200D\u0020", &["\u0646\u200D", "\u0020"]),
21812181
];
21822182

2183-
let test_diff = [
2183+
let test_diff: [(_, &[_], &[_]), .. 23] = [
21842184
("\u0020\u0903", &["\u0020\u0903"], &["\u0020", "\u0903"]), ("\u0020\u0308\u0903",
21852185
&["\u0020\u0308\u0903"], &["\u0020\u0308", "\u0903"]), ("\u000D\u0308\u0903",
21862186
&["\u000D", "\u0308\u0903"], &["\u000D", "\u0308", "\u0903"]), ("\u000A\u0308\u0903",
@@ -2229,9 +2229,11 @@ mod tests {
22292229
// test the indices iterators
22302230
let s = "a̐éö̲\r\n";
22312231
let gr_inds = s.grapheme_indices(true).collect::<Vec<(uint, &str)>>();
2232-
assert_eq!(gr_inds.as_slice(), &[(0u, "a̐"), (3, "é"), (6, "ö̲"), (11, "\r\n")]);
2232+
let b: &[_] = &[(0u, "a̐"), (3, "é"), (6, "ö̲"), (11, "\r\n")];
2233+
assert_eq!(gr_inds.as_slice(), b);
22332234
let gr_inds = s.grapheme_indices(true).rev().collect::<Vec<(uint, &str)>>();
2234-
assert_eq!(gr_inds.as_slice(), &[(11, "\r\n"), (6, "ö̲"), (3, "é"), (0u, "a̐")]);
2235+
let b: &[_] = &[(11, "\r\n"), (6, "ö̲"), (3, "é"), (0u, "a̐")];
2236+
assert_eq!(gr_inds.as_slice(), b);
22352237
let mut gr_inds = s.grapheme_indices(true);
22362238
let e1 = gr_inds.size_hint();
22372239
assert_eq!(e1, (1, Some(13)));
@@ -2243,7 +2245,8 @@ mod tests {
22432245
// make sure the reverse iterator does the right thing with "\n" at beginning of string
22442246
let s = "\n\r\n\r";
22452247
let gr = s.graphemes(true).rev().collect::<Vec<&str>>();
2246-
assert_eq!(gr.as_slice(), &["\r", "\r\n", "\n"]);
2248+
let b: &[_] = &["\r", "\r\n", "\n"];
2249+
assert_eq!(gr.as_slice(), b);
22472250
}
22482251

22492252
#[test]

src/libcollections/string.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,8 @@ impl String {
531531
///
532532
/// ```
533533
/// let s = String::from_str("hello");
534-
/// assert_eq!(s.as_bytes(), &[104, 101, 108, 108, 111]);
534+
/// let b: &[_] = &[104, 101, 108, 108, 111];
535+
/// assert_eq!(s.as_bytes(), b);
535536
/// ```
536537
#[inline]
537538
pub fn as_bytes<'a>(&'a self) -> &'a [u8] {
@@ -552,7 +553,8 @@ impl String {
552553
/// bytes[1] = 51;
553554
/// bytes[4] = 48;
554555
/// }
555-
/// assert_eq!(s.as_bytes(), &[104, 51, 108, 108, 48]);
556+
/// let b: &[_] = &[104, 51, 108, 108, 48];
557+
/// assert_eq!(s.as_bytes(), b);
556558
/// assert_eq!(s.as_slice(), "h3ll0")
557559
/// ```
558560
#[inline]

src/libcore/cmp.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,13 @@ impl Ordering {
112112
/// assert_eq!(Greater.reverse(), Less);
113113
///
114114
///
115-
/// let mut data = &mut [2u, 10, 5, 8];
115+
/// let mut data: &mut [_] = &mut [2u, 10, 5, 8];
116116
///
117117
/// // sort the array from largest to smallest.
118118
/// data.sort_by(|a, b| a.cmp(b).reverse());
119119
///
120-
/// assert_eq!(data, &mut [10u, 8, 5, 2]);
120+
/// let b: &mut [_] = &mut [10u, 8, 5, 2];
121+
/// assert!(data == b);
121122
/// ```
122123
#[inline]
123124
#[experimental]

src/libcore/option.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,10 @@ impl<T> Slice<T> for Option<T> {
530530
fn as_slice<'a>(&'a self) -> &'a [T] {
531531
match *self {
532532
Some(ref x) => slice::ref_slice(x),
533-
None => &[]
533+
None => {
534+
let result: &[_] = &[];
535+
result
536+
}
534537
}
535538
}
536539
}

src/libcore/raw.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ pub struct TraitObject {
5858
}
5959
#[cfg(not(stage0))]
6060
pub struct TraitObject {
61-
pub data: *(),
62-
pub vtable: *(),
61+
pub data: *mut (),
62+
pub vtable: *mut (),
6363
}
6464

6565
/// This trait is meant to map equivalences between raw structs and their

src/libcore/slice.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,6 +1648,27 @@ impl<'a,T:PartialEq, V: Slice<T>> Equiv<V> for &'a [T] {
16481648
fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() }
16491649
}
16501650

1651+
#[unstable = "waiting for DST"]
1652+
impl<'a,T:PartialEq> PartialEq for &'a mut [T] {
1653+
fn eq(&self, other: & &'a mut [T]) -> bool {
1654+
self.len() == other.len() &&
1655+
order::eq(self.iter(), other.iter())
1656+
}
1657+
fn ne(&self, other: & &'a mut [T]) -> bool {
1658+
self.len() != other.len() ||
1659+
order::ne(self.iter(), other.iter())
1660+
}
1661+
}
1662+
1663+
#[unstable = "waiting for DST"]
1664+
impl<'a,T:Eq> Eq for &'a mut [T] {}
1665+
1666+
#[unstable = "waiting for DST"]
1667+
impl<'a,T:PartialEq, V: Slice<T>> Equiv<V> for &'a mut [T] {
1668+
#[inline]
1669+
fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() }
1670+
}
1671+
16511672
#[unstable = "waiting for DST"]
16521673
impl<'a,T:Ord> Ord for &'a [T] {
16531674
fn cmp(&self, other: & &'a [T]) -> Ordering {

src/libcoretest/iter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ fn test_collect() {
368368

369369
#[test]
370370
fn test_all() {
371-
let v: Box<&[int]> = box &[1i, 2, 3, 4, 5];
371+
let v: Box<[int]> = box [1i, 2, 3, 4, 5];
372372
assert!(v.iter().all(|&x| x < 10));
373373
assert!(!v.iter().all(|&x| x % 2 == 0));
374374
assert!(!v.iter().all(|&x| x > 100));
@@ -377,7 +377,7 @@ fn test_all() {
377377

378378
#[test]
379379
fn test_any() {
380-
let v: Box<&[int]> = box &[1i, 2, 3, 4, 5];
380+
let v: Box<[int]> = box [1i, 2, 3, 4, 5];
381381
assert!(v.iter().any(|&x| x < 10));
382382
assert!(v.iter().any(|&x| x % 2 == 0));
383383
assert!(!v.iter().any(|&x| x > 100));

src/libdebug/reflect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ impl<V:TyVisitor + MovePtr> TyVisitor for MovePtrAdaptor<V> {
251251
}
252252
#[cfg(not(stage0))]
253253
fn visit_evec_fixed(&mut self, n: uint, sz: uint, align: uint,
254-
inner: *TyDesc) -> bool {
254+
inner: *const TyDesc) -> bool {
255255
self.align(align);
256256
if ! self.inner.visit_evec_fixed(n, sz, align, inner) {
257257
return false;

src/libdebug/repr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ impl<'a> TyVisitor for ReprVisitor<'a> {
342342

343343
#[cfg(not(stage0))]
344344
fn visit_evec_fixed(&mut self, n: uint, sz: uint, _align: uint,
345-
inner: *TyDesc) -> bool {
345+
inner: *const TyDesc) -> bool {
346346
let assumed_size = if sz == 0 { n } else { sz };
347347
self.get::<()>(|this, b| {
348348
this.write_vec_range(b, assumed_size, inner)

0 commit comments

Comments
 (0)