Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
62645a1
Fix ICE when dividing integral SIMD types.
hirschenberger Mar 25, 2015
6370f29
std: Stabilize parts of std::os::platform::io
alexcrichton Mar 26, 2015
df65f59
replace deprecated as_slice()
demelev Mar 30, 2015
2a89d69
libcore: Ensure min and max functions are consistent for equal inputs
Ryman Mar 30, 2015
f19e763
std: Stabilize the rest of Any/BoxAny
alexcrichton Mar 30, 2015
e17f4fc
convert: remove FromError, use From<E> instead
seanmonstar Mar 31, 2015
606f50c
Lex binary and octal literals more eagerly.
huonw Mar 30, 2015
a78d383
Update lib.rs
wettowelreactor Mar 31, 2015
edc096d
Document std::borrow with examples
steveklabnik Mar 24, 2015
fe8a660
Last docs for std::env
steveklabnik Mar 31, 2015
5872ae4
Indicate select! is code-like
frewsxcv Mar 31, 2015
5d0beb7
rollup merge of #23549: aturon/stab-num
alexcrichton Mar 31, 2015
03c2f33
rollup merge of #23669: steveklabnik/doc_std_borrow
alexcrichton Mar 31, 2015
9fc51ef
Stabilize `std::convert` and related code
aturon Mar 30, 2015
cf56162
Fix up iterator documentation with regards to for loop sugar
steveklabnik Mar 31, 2015
9ba7974
book: reword timer bit
Mar 31, 2015
d9a6e86
Fixup primitive.str docs
steveklabnik Mar 31, 2015
5cf126a
std: Remove #[old_orphan_check] from PartialEq
alexcrichton Mar 11, 2015
608fff8
rustc: Remove old_orphan_check entirely
alexcrichton Mar 31, 2015
e48c7c6
Fix spelling
steveklabnik Mar 31, 2015
71982aa
std: Add a process::exit function
alexcrichton Mar 31, 2015
b9ab5fe
Stabilize a few remaining stragglers
aturon Mar 31, 2015
1829974
rollup merge of #23704: hirschenberger/simd-intdiv-ice
alexcrichton Mar 31, 2015
890f0ab
rollup merge of #23766: alexcrichton/stabilize-raw-fd
alexcrichton Mar 31, 2015
d03120a
rollup merge of #23876: alexcrichton/stabilize-any
alexcrichton Mar 31, 2015
f6bd6b4
rollup merge of #23878: Ryman/stable_extremes
alexcrichton Mar 31, 2015
095f1fb
rollup merge of #23882: wettowelreactor/patch-2
alexcrichton Mar 31, 2015
5e0bda0
rollup merge of #23885: steveklabnik/doc_std_env
alexcrichton Mar 31, 2015
6d2c640
rollup merge of #23886: demelev/remove_as_slice_usage
alexcrichton Mar 31, 2015
acdb0f9
rollup merge of #23893: frewsxcv/patch-6
alexcrichton Mar 31, 2015
d4a2c94
std: Clean out #[deprecated] APIs
alexcrichton Mar 30, 2015
e3f2d45
rollup merge of #23872: huonw/eager-lexing
alexcrichton Mar 31, 2015
94137a3
Test fixes and rebase conflicts, round 1
alexcrichton Mar 31, 2015
da04788
rollup merge of #23875: aturon/revise-convert-2
alexcrichton Mar 31, 2015
e10ee2c
rollup merge of #23879: seanmonstar/del-from-error
alexcrichton Mar 31, 2015
554946c
rollup merge of #23873: alexcrichton/remove-deprecated
alexcrichton Mar 31, 2015
3053288
Test fixes and rebase conflicts, round 2
alexcrichton Mar 31, 2015
82889f7
rollup merge of #23902: freebroccolo/master
alexcrichton Mar 31, 2015
0cac5b6
rollup merge of #23906: steveklabnik/spellin
alexcrichton Mar 31, 2015
a37311d
rollup merge of #23907: alexcrichton/impl-exit
alexcrichton Mar 31, 2015
30283d4
rollup merge of #23908: aturon/stab-more-stragglers
alexcrichton Mar 31, 2015
3422be3
rollup merge of #23288: alexcrichton/issue-19470
alexcrichton Mar 31, 2015
8da0831
Move benchmark tests to unstable section
steveklabnik Mar 31, 2015
9ab6cc9
rollup merge of #23901: steveklabnik/fix_links_str
alexcrichton Mar 31, 2015
6659865
rollup merge of #23920: steveklabnik/gh23881
alexcrichton Mar 31, 2015
ac77392
std: Stabilize last bits of io::Error
alexcrichton Mar 31, 2015
85e997a
rollup merge of #23899: steveklabnik/gh23851
alexcrichton Mar 31, 2015
50b3ecf
rollup merge of #23919: alexcrichton/stabilize-io-error
alexcrichton Mar 31, 2015
55e531d
Add test for #17746
aturon Mar 31, 2015
371ba00
Add description of + for multiple trait bounds
steveklabnik Mar 31, 2015
72f5973
Test fixes and rebase conflicts, round 3
alexcrichton Mar 31, 2015
4f643d7
rollup merge of #23863: pnkfelix/arith-oflo-const-eval
alexcrichton Apr 1, 2015
1d5ef75
rollup merge of #23921: aturon/issue-17746
alexcrichton Apr 1, 2015
6ebb6e6
rollup merge of #23923: steveklabnik/gh23688
alexcrichton Apr 1, 2015
8dff0ac
Test fixes and rebase conflicts
alexcrichton Apr 1, 2015
2b71aed
Update android tests to reflect API switch from `os::env` to `env::va…
pnkfelix Apr 1, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/doc/trpl/macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ number of elements.

```rust
let x: Vec<u32> = vec![1, 2, 3];
# assert_eq!(&[1,2,3], &x);
# assert_eq!(x, [1, 2, 3]);
```

This can't be an ordinary function, because it takes any number of arguments.
Expand All @@ -51,7 +51,7 @@ let x: Vec<u32> = {
temp_vec.push(3);
temp_vec
};
# assert_eq!(&[1,2,3], &x);
# assert_eq!(x, [1, 2, 3]);
```

We can implement this shorthand, using a macro: [^actual]
Expand All @@ -73,7 +73,7 @@ macro_rules! vec {
};
}
# fn main() {
# assert_eq!([1,2,3], vec![1,2,3]);
# assert_eq!(vec![1,2,3], [1, 2, 3]);
# }
```

Expand Down
2 changes: 1 addition & 1 deletion src/libcollections/linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,7 @@ mod test {
thread::spawn(move || {
check_links(&n);
let a: &[_] = &[&1,&2,&3];
assert_eq!(a, n.iter().collect::<Vec<_>>());
assert_eq!(a, &n.iter().collect::<Vec<_>>()[..]);
}).join().ok().unwrap();
}

Expand Down
22 changes: 11 additions & 11 deletions src/libcollections/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1540,22 +1540,22 @@ impl<T> Extend<T> for Vec<T> {
}

__impl_slice_eq1! { Vec<A>, Vec<B> }
__impl_slice_eq2! { Vec<A>, &'b [B] }
__impl_slice_eq2! { Vec<A>, &'b mut [B] }
__impl_slice_eq2! { Cow<'a, [A]>, &'b [B], Clone }
__impl_slice_eq2! { Cow<'a, [A]>, &'b mut [B], Clone }
__impl_slice_eq2! { Cow<'a, [A]>, Vec<B>, Clone }
__impl_slice_eq1! { Vec<A>, &'b [B] }
__impl_slice_eq1! { Vec<A>, &'b mut [B] }
__impl_slice_eq1! { Cow<'a, [A]>, &'b [B], Clone }
__impl_slice_eq1! { Cow<'a, [A]>, &'b mut [B], Clone }
__impl_slice_eq1! { Cow<'a, [A]>, Vec<B>, Clone }

macro_rules! array_impls {
($($N: expr)+) => {
$(
// NOTE: some less important impls are omitted to reduce code bloat
__impl_slice_eq2! { Vec<A>, [B; $N] }
__impl_slice_eq2! { Vec<A>, &'b [B; $N] }
// __impl_slice_eq2! { Vec<A>, &'b mut [B; $N] }
// __impl_slice_eq2! { Cow<'a, [A]>, [B; $N], Clone }
// __impl_slice_eq2! { Cow<'a, [A]>, &'b [B; $N], Clone }
// __impl_slice_eq2! { Cow<'a, [A]>, &'b mut [B; $N], Clone }
__impl_slice_eq1! { Vec<A>, [B; $N] }
__impl_slice_eq1! { Vec<A>, &'b [B; $N] }
// __impl_slice_eq1! { Vec<A>, &'b mut [B; $N] }
// __impl_slice_eq1! { Cow<'a, [A]>, [B; $N], Clone }
// __impl_slice_eq1! { Cow<'a, [A]>, &'b [B; $N], Clone }
// __impl_slice_eq1! { Cow<'a, [A]>, &'b mut [B; $N], Clone }
)+
}
}
Expand Down
22 changes: 11 additions & 11 deletions src/libcollectionstest/enum_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,19 +153,19 @@ fn test_iterator() {

e1.insert(A);
let elems: Vec<_> = e1.iter().collect();
assert_eq!([A], elems);
assert_eq!(elems, [A]);

e1.insert(C);
let elems: Vec<_> = e1.iter().collect();
assert_eq!([A,C], elems);
assert_eq!(elems, [A,C]);

e1.insert(C);
let elems: Vec<_> = e1.iter().collect();
assert_eq!([A,C], elems);
assert_eq!(elems, [A,C]);

e1.insert(B);
let elems: Vec<_> = e1.iter().collect();
assert_eq!([A,B,C], elems);
assert_eq!(elems, [A,B,C]);
}

///////////////////////////////////////////////////////////////////////////
Expand All @@ -183,35 +183,35 @@ fn test_operators() {

let e_union = e1 | e2;
let elems: Vec<_> = e_union.iter().collect();
assert_eq!([A,B,C], elems);
assert_eq!(elems, [A,B,C]);

let e_intersection = e1 & e2;
let elems: Vec<_> = e_intersection.iter().collect();
assert_eq!([C], elems);
assert_eq!(elems, [C]);

// Another way to express intersection
let e_intersection = e1 - (e1 - e2);
let elems: Vec<_> = e_intersection.iter().collect();
assert_eq!([C], elems);
assert_eq!(elems, [C]);

let e_subtract = e1 - e2;
let elems: Vec<_> = e_subtract.iter().collect();
assert_eq!([A], elems);
assert_eq!(elems, [A]);

// Bitwise XOR of two sets, aka symmetric difference
let e_symmetric_diff = e1 ^ e2;
let elems: Vec<_> = e_symmetric_diff.iter().collect();
assert_eq!([A,B], elems);
assert_eq!(elems, [A,B]);

// Another way to express symmetric difference
let e_symmetric_diff = (e1 - e2) | (e2 - e1);
let elems: Vec<_> = e_symmetric_diff.iter().collect();
assert_eq!([A,B], elems);
assert_eq!(elems, [A,B]);

// Yet another way to express symmetric difference
let e_symmetric_diff = (e1 | e2) - (e1 & e2);
let elems: Vec<_> = e_symmetric_diff.iter().collect();
assert_eq!([A,B], elems);
assert_eq!(elems, [A,B]);
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion src/libcollectionstest/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ fn test_collect() {
fn test_into_bytes() {
let data = String::from_str("asdf");
let buf = data.into_bytes();
assert_eq!(b"asdf", buf);
assert_eq!(buf, b"asdf");
}

#[test]
Expand Down
12 changes: 6 additions & 6 deletions src/libcollectionstest/vec_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ fn test_as_slices() {

let (left, right) = ring.as_slices();
let expected: Vec<_> = (0..i+1).collect();
assert_eq!(left, expected);
assert_eq!(left, &expected[..]);
assert_eq!(right, []);
}

Expand All @@ -829,8 +829,8 @@ fn test_as_slices() {
let (left, right) = ring.as_slices();
let expected_left: Vec<_> = (-last..j+1).rev().collect();
let expected_right: Vec<_> = (0..first).collect();
assert_eq!(left, expected_left);
assert_eq!(right, expected_right);
assert_eq!(left, &expected_left[..]);
assert_eq!(right, &expected_right[..]);
}

assert_eq!(ring.len() as i32, cap);
Expand All @@ -848,7 +848,7 @@ fn test_as_mut_slices() {

let (left, right) = ring.as_mut_slices();
let expected: Vec<_> = (0..i+1).collect();
assert_eq!(left, expected);
assert_eq!(left, &expected[..]);
assert_eq!(right, []);
}

Expand All @@ -857,8 +857,8 @@ fn test_as_mut_slices() {
let (left, right) = ring.as_mut_slices();
let expected_left: Vec<_> = (-last..j+1).rev().collect();
let expected_right: Vec<_> = (0..first).collect();
assert_eq!(left, expected_left);
assert_eq!(right, expected_right);
assert_eq!(left, &expected_left[..]);
assert_eq!(right, &expected_right[..]);
}

assert_eq!(ring.len() as i32, cap);
Expand Down
1 change: 0 additions & 1 deletion src/libcore/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ use option::Option::{self, Some, None};
/// inverse of `ne`; that is, `!(a == b)` if and only if `a != b`.
#[lang="eq"]
#[stable(feature = "rust1", since = "1.0.0")]
#[old_orphan_check]
pub trait PartialEq<Rhs: ?Sized = Self> {
/// This method tests for `self` and `other` values to be equal, and is used by `==`.
#[stable(feature = "rust1", since = "1.0.0")]
Expand Down
13 changes: 5 additions & 8 deletions src/libcore/cmp_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
#[macro_export]
macro_rules! __impl_slice_eq1 {
($Lhs: ty, $Rhs: ty) => {
__impl_slice_eq1! { $Lhs, $Rhs, Sized }
};
($Lhs: ty, $Rhs: ty, $Bound: ident) => {
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, 'b, A, B> PartialEq<$Rhs> for $Lhs where A: PartialEq<B> {
impl<'a, 'b, A: $Bound, B> PartialEq<$Rhs> for $Lhs where A: PartialEq<B> {
#[inline]
fn eq(&self, other: &$Rhs) -> bool { &self[..] == &other[..] }
#[inline]
Expand All @@ -31,13 +34,7 @@ macro_rules! __impl_slice_eq2 {
__impl_slice_eq2! { $Lhs, $Rhs, Sized }
};
($Lhs: ty, $Rhs: ty, $Bound: ident) => {
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, 'b, A: $Bound, B> PartialEq<$Rhs> for $Lhs where A: PartialEq<B> {
#[inline]
fn eq(&self, other: &$Rhs) -> bool { &self[..] == &other[..] }
#[inline]
fn ne(&self, other: &$Rhs) -> bool { &self[..] != &other[..] }
}
__impl_slice_eq1!($Lhs, $Rhs, $Bound);

#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, 'b, A: $Bound, B> PartialEq<$Lhs> for $Rhs where B: PartialEq<A> {
Expand Down
11 changes: 5 additions & 6 deletions src/libcore/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -532,10 +532,9 @@ pub trait Iterator {
/// # Examples
///
/// ```
/// # #![feature(core)]
/// let a = [1, 2, 3, 4, 5];
/// let b: Vec<_> = a.iter().cloned().collect();
/// assert_eq!(a, b);
/// let expected = [1, 2, 3, 4, 5];
/// let actual: Vec<_> = expected.iter().cloned().collect();
/// assert_eq!(actual, expected);
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
Expand Down Expand Up @@ -943,8 +942,8 @@ pub trait Iterator {
/// # #![feature(core)]
/// let a = [(1, 2), (3, 4)];
/// let (left, right): (Vec<_>, Vec<_>) = a.iter().cloned().unzip();
/// assert_eq!([1, 3], left);
/// assert_eq!([2, 4], right);
/// assert_eq!(left, [1, 3]);
/// assert_eq!(right, [2, 4]);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB) where
Expand Down
12 changes: 5 additions & 7 deletions src/libcore/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ macro_rules! assert {
);
}

/// Asserts that two expressions are equal to each other, testing equality in
/// both directions.
/// Asserts that two expressions are equal to each other.
///
/// On panic, this macro will print the values of the expressions.
/// On panic, this macro will print the values of the expressions with their
/// debug representations.
///
/// # Examples
///
Expand All @@ -84,10 +84,8 @@ macro_rules! assert_eq {
($left:expr , $right:expr) => ({
match (&($left), &($right)) {
(left_val, right_val) => {
// check both directions of equality....
if !((*left_val == *right_val) &&
(*right_val == *left_val)) {
panic!("assertion failed: `(left == right) && (right == left)` \
if !(*left_val == *right_val) {
panic!("assertion failed: `(left == right)` \
(left: `{:?}`, right: `{:?}`)", *left_val, *right_val)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/libcoretest/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ fn test_transmute() {
}

unsafe {
assert_eq!([76], transmute::<_, Vec<u8>>("L".to_string()));
assert_eq!(transmute::<_, Vec<u8>>("L".to_string()), [76]);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/libfmt_macros/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ mod tests {

fn same(fmt: &'static str, p: &[Piece<'static>]) {
let parser = Parser::new(fmt);
assert!(p == parser.collect::<Vec<Piece<'static>>>());
assert!(parser.collect::<Vec<Piece<'static>>>() == p);
}

fn fmtdflt() -> FormatSpec<'static> {
Expand Down
11 changes: 5 additions & 6 deletions src/librustc_driver/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -808,12 +808,11 @@ fn walk_ty() {
let tup2_ty = ty::mk_tup(tcx, vec!(tup1_ty, tup1_ty, uint_ty));
let uniq_ty = ty::mk_uniq(tcx, tup2_ty);
let walked: Vec<_> = uniq_ty.walk().collect();
assert_eq!([uniq_ty,
tup2_ty,
tup1_ty, int_ty, uint_ty, int_ty, uint_ty,
tup1_ty, int_ty, uint_ty, int_ty, uint_ty,
uint_ty],
walked);
assert_eq!(walked, [uniq_ty,
tup2_ty,
tup1_ty, int_ty, uint_ty, int_ty, uint_ty,
tup1_ty, int_ty, uint_ty, int_ty, uint_ty,
uint_ty]);
})
}

Expand Down
30 changes: 13 additions & 17 deletions src/librustc_typeck/coherence/orphan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,25 +215,21 @@ impl<'cx, 'tcx> OrphanChecker<'cx, 'tcx> {
match traits::orphan_check(self.tcx, def_id) {
Ok(()) => { }
Err(traits::OrphanCheckErr::NoLocalInputType) => {
if !ty::has_attr(self.tcx, trait_def_id, "old_orphan_check") {
span_err!(
self.tcx.sess, item.span, E0117,
"the impl does not reference any \
types defined in this crate; \
only traits defined in the current crate can be \
implemented for arbitrary types");
return;
}
span_err!(
self.tcx.sess, item.span, E0117,
"the impl does not reference any \
types defined in this crate; \
only traits defined in the current crate can be \
implemented for arbitrary types");
return;
}
Err(traits::OrphanCheckErr::UncoveredTy(param_ty)) => {
if !ty::has_attr(self.tcx, trait_def_id, "old_orphan_check") {
span_err!(self.tcx.sess, item.span, E0210,
"type parameter `{}` must be used as the type parameter for \
some local type (e.g. `MyStruct<T>`); only traits defined in \
the current crate can be implemented for a type parameter",
param_ty.user_string(self.tcx));
return;
}
span_err!(self.tcx.sess, item.span, E0210,
"type parameter `{}` must be used as the type parameter for \
some local type (e.g. `MyStruct<T>`); only traits defined in \
the current crate can be implemented for a type parameter",
param_ty.user_string(self.tcx));
return;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/libstd/collections/hash/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ mod test_set {
};

let v = hs.into_iter().collect::<Vec<char>>();
assert!(['a', 'b'] == v || ['b', 'a'] == v);
assert!(v == ['a', 'b'] || v == ['b', 'a']);
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/old_io/buffered.rs
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ mod test {
let mut w = BufferedWriter::with_capacity(3, Vec::new());
w.write_all(&[0, 1]).unwrap();
let a: &[_] = &[];
assert_eq!(a, &w.get_ref()[..]);
assert_eq!(&w.get_ref()[..], a);
let w = w.into_inner();
let a: &[_] = &[0, 1];
assert_eq!(a, &w[..]);
Expand Down
Loading