Skip to content

Commit 5769f1a

Browse files
committed
---
yaml --- r: 218351 b: refs/heads/master c: 8ac0bce h: refs/heads/master i: 218349: 5fd38bb 218347: 0a7de14 218343: 56d79f4 218335: 92f454e v: v3
1 parent 2b89b54 commit 5769f1a

File tree

51 files changed

+186
-468
lines changed

Some content is hidden

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

51 files changed

+186
-468
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: 67256dff6dd7526f0be9da5092a6b3e390654c8c
2+
refs/heads/master: 8ac0bce64eba7c3433a481d78b617baf62eaac47
33
refs/heads/snap-stage3: ba0e1cd8147d452c356aacb29fb87568ca26f111
44
refs/heads/try: b53c0f93eedcdedd4fd89bccc5a3a09d1c5cd23e
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

trunk/src/libcollections/bit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ impl BitVec {
283283
pub fn from_elem(nbits: usize, bit: bool) -> BitVec {
284284
let nblocks = blocks_for_bits(nbits);
285285
let mut bit_vec = BitVec {
286-
storage: vec![if bit { !0 } else { 0 }; nblocks],
286+
storage: repeat(if bit { !0 } else { 0 }).take(nblocks).collect(),
287287
nbits: nbits
288288
};
289289
bit_vec.fix_last_block();

trunk/src/libcollectionstest/slice.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,7 +1318,7 @@ mod bench {
13181318

13191319
#[bench]
13201320
fn mut_iterator(b: &mut Bencher) {
1321-
let mut v = vec![0; 100];
1321+
let mut v: Vec<_> = repeat(0).take(100).collect();
13221322

13231323
b.iter(|| {
13241324
let mut i = 0;
@@ -1419,7 +1419,7 @@ mod bench {
14191419
#[bench]
14201420
fn zero_1kb_from_elem(b: &mut Bencher) {
14211421
b.iter(|| {
1422-
vec![0u8; 1024]
1422+
repeat(0u8).take(1024).collect::<Vec<_>>()
14231423
});
14241424
}
14251425

@@ -1467,7 +1467,7 @@ mod bench {
14671467
fn random_inserts(b: &mut Bencher) {
14681468
let mut rng = thread_rng();
14691469
b.iter(|| {
1470-
let mut v = vec![(0, 0); 30];
1470+
let mut v: Vec<_> = repeat((0, 0)).take(30).collect();
14711471
for _ in 0..100 {
14721472
let l = v.len();
14731473
v.insert(rng.gen::<usize>() % (l + 1),
@@ -1479,7 +1479,7 @@ mod bench {
14791479
fn random_removes(b: &mut Bencher) {
14801480
let mut rng = thread_rng();
14811481
b.iter(|| {
1482-
let mut v = vec![(0, 0); 130];
1482+
let mut v: Vec<_> = repeat((0, 0)).take(130).collect();
14831483
for _ in 0..100 {
14841484
let l = v.len();
14851485
v.remove(rng.gen::<usize>() % l);

trunk/src/libcore/intrinsics.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -586,18 +586,18 @@ extern "rust-intrinsic" {
586586
pub fn overflowing_mul<T>(a: T, b: T) -> T;
587587

588588
/// Performs an unchecked signed division, which results in undefined behavior,
589-
/// in cases where y == 0, or x == isize::MIN and y == -1
589+
/// in cases where y == 0, or x == int::MIN and y == -1
590590
pub fn unchecked_sdiv<T>(x: T, y: T) -> T;
591591
/// Performs an unchecked unsigned division, which results in undefined behavior,
592592
/// in cases where y == 0
593593
pub fn unchecked_udiv<T>(x: T, y: T) -> T;
594594

595595
/// Returns the remainder of an unchecked signed division, which results in
596-
/// undefined behavior, in cases where y == 0, or x == isize::MIN and y == -1
597-
pub fn unchecked_srem<T>(x: T, y: T) -> T;
598-
/// Returns the remainder of an unchecked unsigned division, which results in
599-
/// undefined behavior, in cases where y == 0
596+
/// undefined behavior, in cases where y == 0, or x == int::MIN and y == -1
600597
pub fn unchecked_urem<T>(x: T, y: T) -> T;
598+
/// Returns the remainder of an unchecked signed division, which results in
599+
/// undefined behavior, in cases where y == 0
600+
pub fn unchecked_srem<T>(x: T, y: T) -> T;
601601

602602
/// Returns the value of the discriminant for the variant in 'v',
603603
/// cast to a `u64`; if `T` has no discriminant, returns 0.

trunk/src/libcore/num/wrapping.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -119,16 +119,6 @@ macro_rules! wrapping_impl {
119119
}
120120
}
121121

122-
#[stable(feature = "wrapping_div", since = "1.3.0")]
123-
impl Div for Wrapping<$t> {
124-
type Output = Wrapping<$t>;
125-
126-
#[inline(always)]
127-
fn div(self, other: Wrapping<$t>) -> Wrapping<$t> {
128-
Wrapping(self.0.wrapping_div(other.0))
129-
}
130-
}
131-
132122
#[stable(feature = "rust1", since = "1.0.0")]
133123
impl Not for Wrapping<$t> {
134124
type Output = Wrapping<$t>;

trunk/src/libcore/slice.rs

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,30 +1463,12 @@ pub mod bytes {
14631463
#[stable(feature = "rust1", since = "1.0.0")]
14641464
impl<A, B> PartialEq<[B]> for [A] where A: PartialEq<B> {
14651465
fn eq(&self, other: &[B]) -> bool {
1466-
if self.len() != other.len() {
1467-
return false;
1468-
}
1469-
1470-
for i in 0..self.len() {
1471-
if !self[i].eq(&other[i]) {
1472-
return false;
1473-
}
1474-
}
1475-
1476-
true
1466+
self.len() == other.len() &&
1467+
order::eq(self.iter(), other.iter())
14771468
}
14781469
fn ne(&self, other: &[B]) -> bool {
1479-
if self.len() != other.len() {
1480-
return true;
1481-
}
1482-
1483-
for i in 0..self.len() {
1484-
if self[i].ne(&other[i]) {
1485-
return true;
1486-
}
1487-
}
1488-
1489-
false
1470+
self.len() != other.len() ||
1471+
order::ne(self.iter(), other.iter())
14901472
}
14911473
}
14921474

trunk/src/libcoretest/ptr.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
use core::ptr::*;
1212
use core::mem;
13+
use std::iter::repeat;
1314

1415
#[test]
1516
fn test() {
@@ -109,7 +110,7 @@ fn test_as_mut() {
109110
#[test]
110111
fn test_ptr_addition() {
111112
unsafe {
112-
let xs = vec![5; 16];
113+
let xs = repeat(5).take(16).collect::<Vec<_>>();
113114
let mut ptr = xs.as_ptr();
114115
let end = ptr.offset(16);
115116

@@ -127,7 +128,7 @@ fn test_ptr_addition() {
127128
m_ptr = m_ptr.offset(1);
128129
}
129130

130-
assert!(xs_mut == vec![10; 16]);
131+
assert!(xs_mut == repeat(10).take(16).collect::<Vec<_>>());
131132
}
132133
}
133134

trunk/src/libgraphviz/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,7 @@ mod tests {
599599
use std::io;
600600
use std::io::prelude::*;
601601
use std::borrow::IntoCow;
602+
use std::iter::repeat;
602603

603604
/// each node is an index in a vector in the graph.
604605
type Node = usize;
@@ -646,7 +647,7 @@ mod tests {
646647
fn to_opt_strs(self) -> Vec<Option<&'static str>> {
647648
match self {
648649
UnlabelledNodes(len)
649-
=> vec![None; len],
650+
=> repeat(None).take(len).collect(),
650651
AllNodesLabelled(lbls)
651652
=> lbls.into_iter().map(
652653
|l|Some(l)).collect(),

trunk/src/liblibc/lib.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2522,7 +2522,6 @@ pub mod consts {
25222522
pub const S_IFDIR : c_int = 16384;
25232523
pub const S_IFREG : c_int = 32768;
25242524
pub const S_IFLNK : c_int = 40960;
2525-
pub const S_IFSOCK : mode_t = 49152;
25262525
pub const S_IFMT : c_int = 61440;
25272526
pub const S_IEXEC : c_int = 64;
25282527
pub const S_IWRITE : c_int = 128;
@@ -2882,7 +2881,6 @@ pub mod consts {
28822881
pub const S_IFDIR : mode_t = 16384;
28832882
pub const S_IFREG : mode_t = 32768;
28842883
pub const S_IFLNK : mode_t = 40960;
2885-
pub const S_IFSOCK : mode_t = 49152;
28862884
pub const S_IFMT : mode_t = 61440;
28872885
pub const S_IEXEC : mode_t = 64;
28882886
pub const S_IWRITE : mode_t = 128;
@@ -3105,7 +3103,6 @@ pub mod consts {
31053103
pub const S_IFDIR : mode_t = 16384;
31063104
pub const S_IFREG : mode_t = 32768;
31073105
pub const S_IFLNK : mode_t = 40960;
3108-
pub const S_IFSOCK : mode_t = 49152;
31093106
pub const S_IFMT : mode_t = 61440;
31103107
pub const S_IEXEC : mode_t = 64;
31113108
pub const S_IWRITE : mode_t = 128;
@@ -3908,7 +3905,6 @@ pub mod consts {
39083905
pub const S_IFDIR : mode_t = 16384;
39093906
pub const S_IFREG : mode_t = 32768;
39103907
pub const S_IFLNK : mode_t = 40960;
3911-
pub const S_IFSOCK : mode_t = 49152;
39123908
pub const S_IFMT : mode_t = 61440;
39133909
pub const S_IEXEC : mode_t = 64;
39143910
pub const S_IWRITE : mode_t = 128;
@@ -4369,7 +4365,6 @@ pub mod consts {
43694365
pub const S_IFDIR : mode_t = 16384;
43704366
pub const S_IFREG : mode_t = 32768;
43714367
pub const S_IFLNK : mode_t = 40960;
4372-
pub const S_IFSOCK : mode_t = 49152;
43734368
pub const S_IFMT : mode_t = 61440;
43744369
pub const S_IEXEC : mode_t = 64;
43754370
pub const S_IWRITE : mode_t = 128;
@@ -4796,7 +4791,6 @@ pub mod consts {
47964791
pub const S_IFDIR : mode_t = 16384;
47974792
pub const S_IFREG : mode_t = 32768;
47984793
pub const S_IFLNK : mode_t = 40960;
4799-
pub const S_IFSOCK : mode_t = 49152;
48004794
pub const S_IFMT : mode_t = 61440;
48014795
pub const S_IEXEC : mode_t = 64;
48024796
pub const S_IWRITE : mode_t = 128;

trunk/src/librand/reseeding.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ mod tests {
186186
const FILL_BYTES_V_LEN: usize = 13579;
187187
#[test]
188188
fn test_rng_fill_bytes() {
189-
let mut v = vec![0; FILL_BYTES_V_LEN];
189+
let mut v = repeat(0).take(FILL_BYTES_V_LEN).collect::<Vec<_>>();
190190
::test::rng().fill_bytes(&mut v);
191191

192192
// Sanity test: if we've gotten here, `fill_bytes` has not infinitely

trunk/src/librustc/diagnostics.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,6 +1211,7 @@ register_diagnostics! {
12111211
E0138,
12121212
E0139,
12131213
E0264, // unknown external lang item
1214+
E0266, // expected item
12141215
E0269, // not all control paths return a value
12151216
E0270, // computation may converge in a function marked as diverging
12161217
E0272, // rustc_on_unimplemented attribute refers to non-existent type parameter

trunk/src/librustc/middle/check_match.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ fn is_useful(cx: &MatchCheckCtxt,
704704
match is_useful(cx, &matrix, v.tail(), witness) {
705705
UsefulWithWitness(pats) => {
706706
let arity = constructor_arity(cx, &constructor, left_ty);
707-
let wild_pats = vec![DUMMY_WILD_PAT; arity];
707+
let wild_pats: Vec<_> = repeat(DUMMY_WILD_PAT).take(arity).collect();
708708
let enum_pat = construct_witness(cx, &constructor, wild_pats, left_ty);
709709
let mut new_pats = vec![enum_pat];
710710
new_pats.extend(pats);
@@ -862,7 +862,7 @@ pub fn specialize<'a>(cx: &MatchCheckCtxt, r: &[&'a Pat],
862862
} = raw_pat(r[col]);
863863
let head: Option<Vec<&Pat>> = match *node {
864864
ast::PatWild(_) =>
865-
Some(vec![DUMMY_WILD_PAT; arity]),
865+
Some(repeat(DUMMY_WILD_PAT).take(arity).collect()),
866866

867867
ast::PatIdent(_, _, _) => {
868868
let opt_def = cx.tcx.def_map.borrow().get(&pat_id).map(|d| d.full_def());
@@ -875,7 +875,7 @@ pub fn specialize<'a>(cx: &MatchCheckCtxt, r: &[&'a Pat],
875875
} else {
876876
None
877877
},
878-
_ => Some(vec![DUMMY_WILD_PAT; arity])
878+
_ => Some(repeat(DUMMY_WILD_PAT).take(arity).collect())
879879
}
880880
}
881881

@@ -889,7 +889,7 @@ pub fn specialize<'a>(cx: &MatchCheckCtxt, r: &[&'a Pat],
889889
DefVariant(..) | DefStruct(..) => {
890890
Some(match args {
891891
&Some(ref args) => args.iter().map(|p| &**p).collect(),
892-
&None => vec![DUMMY_WILD_PAT; arity],
892+
&None => repeat(DUMMY_WILD_PAT).take(arity).collect(),
893893
})
894894
}
895895
_ => None

0 commit comments

Comments
 (0)