Skip to content

Commit e2d1fba

Browse files
committed
---
yaml --- r: 218357 b: refs/heads/master c: 736886c h: refs/heads/master i: 218355: dc6803d v: v3
1 parent e705929 commit e2d1fba

File tree

49 files changed

+456
-151
lines changed

Some content is hidden

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

49 files changed

+456
-151
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: 0c766cb8bc62fcd016165db2313188e7f6de71dd
2+
refs/heads/master: 736886c84b6ad372929b6531dbe05f5e7f88995b
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: repeat(if bit { !0 } else { 0 }).take(nblocks).collect(),
286+
storage: vec![if bit { !0 } else { 0 }; nblocks],
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<_> = repeat(0).take(100).collect();
1321+
let mut v = vec![0; 100];
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-
repeat(0u8).take(1024).collect::<Vec<_>>()
1422+
vec![0u8; 1024]
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<_> = repeat((0, 0)).take(30).collect();
1470+
let mut v = vec![(0, 0); 30];
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<_> = repeat((0, 0)).take(130).collect();
1482+
let mut v = vec![(0, 0); 130];
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 == int::MIN and y == -1
589+
/// in cases where y == 0, or x == isize::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 == int::MIN and y == -1
597-
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
596+
/// undefined behavior, in cases where y == 0, or x == isize::MIN and y == -1
600597
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
600+
pub fn unchecked_urem<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: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,16 @@ 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+
122132
#[stable(feature = "rust1", since = "1.0.0")]
123133
impl Not for Wrapping<$t> {
124134
type Output = Wrapping<$t>;

trunk/src/libcore/slice.rs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,12 +1463,30 @@ 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-
self.len() == other.len() &&
1467-
order::eq(self.iter(), other.iter())
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
14681477
}
14691478
fn ne(&self, other: &[B]) -> bool {
1470-
self.len() != other.len() ||
1471-
order::ne(self.iter(), other.iter())
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
14721490
}
14731491
}
14741492

trunk/src/libcoretest/ptr.rs

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

1111
use core::ptr::*;
1212
use core::mem;
13-
use std::iter::repeat;
1413

1514
#[test]
1615
fn test() {
@@ -110,7 +109,7 @@ fn test_as_mut() {
110109
#[test]
111110
fn test_ptr_addition() {
112111
unsafe {
113-
let xs = repeat(5).take(16).collect::<Vec<_>>();
112+
let xs = vec![5; 16];
114113
let mut ptr = xs.as_ptr();
115114
let end = ptr.offset(16);
116115

@@ -128,7 +127,7 @@ fn test_ptr_addition() {
128127
m_ptr = m_ptr.offset(1);
129128
}
130129

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

trunk/src/libgraphviz/lib.rs

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

604603
/// each node is an index in a vector in the graph.
605604
type Node = usize;
@@ -647,7 +646,7 @@ mod tests {
647646
fn to_opt_strs(self) -> Vec<Option<&'static str>> {
648647
match self {
649648
UnlabelledNodes(len)
650-
=> repeat(None).take(len).collect(),
649+
=> vec![None; len],
651650
AllNodesLabelled(lbls)
652651
=> lbls.into_iter().map(
653652
|l|Some(l)).collect(),

trunk/src/liblibc/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2522,6 +2522,7 @@ 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;
25252526
pub const S_IFMT : c_int = 61440;
25262527
pub const S_IEXEC : c_int = 64;
25272528
pub const S_IWRITE : c_int = 128;
@@ -2881,6 +2882,7 @@ pub mod consts {
28812882
pub const S_IFDIR : mode_t = 16384;
28822883
pub const S_IFREG : mode_t = 32768;
28832884
pub const S_IFLNK : mode_t = 40960;
2885+
pub const S_IFSOCK : mode_t = 49152;
28842886
pub const S_IFMT : mode_t = 61440;
28852887
pub const S_IEXEC : mode_t = 64;
28862888
pub const S_IWRITE : mode_t = 128;
@@ -3103,6 +3105,7 @@ pub mod consts {
31033105
pub const S_IFDIR : mode_t = 16384;
31043106
pub const S_IFREG : mode_t = 32768;
31053107
pub const S_IFLNK : mode_t = 40960;
3108+
pub const S_IFSOCK : mode_t = 49152;
31063109
pub const S_IFMT : mode_t = 61440;
31073110
pub const S_IEXEC : mode_t = 64;
31083111
pub const S_IWRITE : mode_t = 128;
@@ -3905,6 +3908,7 @@ pub mod consts {
39053908
pub const S_IFDIR : mode_t = 16384;
39063909
pub const S_IFREG : mode_t = 32768;
39073910
pub const S_IFLNK : mode_t = 40960;
3911+
pub const S_IFSOCK : mode_t = 49152;
39083912
pub const S_IFMT : mode_t = 61440;
39093913
pub const S_IEXEC : mode_t = 64;
39103914
pub const S_IWRITE : mode_t = 128;
@@ -4365,6 +4369,7 @@ pub mod consts {
43654369
pub const S_IFDIR : mode_t = 16384;
43664370
pub const S_IFREG : mode_t = 32768;
43674371
pub const S_IFLNK : mode_t = 40960;
4372+
pub const S_IFSOCK : mode_t = 49152;
43684373
pub const S_IFMT : mode_t = 61440;
43694374
pub const S_IEXEC : mode_t = 64;
43704375
pub const S_IWRITE : mode_t = 128;
@@ -4791,6 +4796,7 @@ pub mod consts {
47914796
pub const S_IFDIR : mode_t = 16384;
47924797
pub const S_IFREG : mode_t = 32768;
47934798
pub const S_IFLNK : mode_t = 40960;
4799+
pub const S_IFSOCK : mode_t = 49152;
47944800
pub const S_IFMT : mode_t = 61440;
47954801
pub const S_IEXEC : mode_t = 64;
47964802
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 = repeat(0).take(FILL_BYTES_V_LEN).collect::<Vec<_>>();
189+
let mut v = vec![0; FILL_BYTES_V_LEN];
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: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,6 @@ register_diagnostics! {
12111211
E0138,
12121212
E0139,
12131213
E0264, // unknown external lang item
1214-
E0266, // expected item
12151214
E0269, // not all control paths return a value
12161215
E0270, // computation may converge in a function marked as diverging
12171216
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<_> = repeat(DUMMY_WILD_PAT).take(arity).collect();
707+
let wild_pats = vec![DUMMY_WILD_PAT; arity];
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(repeat(DUMMY_WILD_PAT).take(arity).collect()),
865+
Some(vec![DUMMY_WILD_PAT; arity]),
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(repeat(DUMMY_WILD_PAT).take(arity).collect())
878+
_ => Some(vec![DUMMY_WILD_PAT; arity])
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 => repeat(DUMMY_WILD_PAT).take(arity).collect(),
892+
&None => vec![DUMMY_WILD_PAT; arity],
893893
})
894894
}
895895
_ => None

0 commit comments

Comments
 (0)