Skip to content

Commit c13af72

Browse files
committed
---
yaml --- r: 235286 b: refs/heads/stable c: 517e087 h: refs/heads/master v: v3
1 parent 7b52bf4 commit c13af72

File tree

31 files changed

+638
-328
lines changed

31 files changed

+638
-328
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: afae2ff723393b3ab4ccffef6ac7c6d1809e2da0
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: f859507de8c410b648d934d8f5ec1c52daac971d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 830e82df1427b266ff5ed5edee95bb1f1282eb35
32+
refs/heads/stable: 517e087c16749086a3a0fec453af3d1c53232605
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/src/liballoc/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,5 @@ pub fn oom() -> ! {
148148
// optimize it out).
149149
#[doc(hidden)]
150150
#[unstable(feature = "issue_14344_fixme")]
151+
#[cfg(stage0)]
151152
pub fn fixme_14344_be_sure_to_link_to_collections() {}

branches/stable/src/libcollections/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ pub mod btree_set {
138138
// FIXME(#14344) this shouldn't be necessary
139139
#[doc(hidden)]
140140
#[unstable(feature = "issue_14344_fixme")]
141+
#[cfg(stage0)]
141142
pub fn fixme_14344_be_sure_to_link_to_collections() {}
142143

143144
#[cfg(not(test))]

branches/stable/src/libcollections/vec.rs

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ use core::cmp::Ordering;
6767
use core::fmt;
6868
use core::hash::{self, Hash};
6969
use core::intrinsics::{arith_offset, assume};
70-
use core::iter::{repeat, FromIterator};
70+
use core::iter::FromIterator;
7171
use core::marker::PhantomData;
7272
use core::mem;
7373
use core::ops::{Index, IndexMut, Deref};
@@ -1106,12 +1106,35 @@ impl<T: Clone> Vec<T> {
11061106
let len = self.len();
11071107

11081108
if new_len > len {
1109-
self.extend(repeat(value).take(new_len - len));
1109+
self.extend_with_element(new_len - len, value);
11101110
} else {
11111111
self.truncate(new_len);
11121112
}
11131113
}
11141114

1115+
/// Extend the vector by `n` additional clones of `value`.
1116+
fn extend_with_element(&mut self, n: usize, value: T) {
1117+
self.reserve(n);
1118+
1119+
unsafe {
1120+
let len = self.len();
1121+
let mut ptr = self.as_mut_ptr().offset(len as isize);
1122+
// Write all elements except the last one
1123+
for i in 1..n {
1124+
ptr::write(ptr, value.clone());
1125+
ptr = ptr.offset(1);
1126+
// Increment the length in every step in case clone() panics
1127+
self.set_len(len + i);
1128+
}
1129+
1130+
if n > 0 {
1131+
// We can write the last element directly without cloning needlessly
1132+
ptr::write(ptr, value);
1133+
self.set_len(len + n);
1134+
}
1135+
}
1136+
}
1137+
11151138
/// Appends all elements in a slice to the `Vec`.
11161139
///
11171140
/// Iterates over the slice `other`, clones each element, and then appends
@@ -1294,25 +1317,9 @@ unsafe fn dealloc<T>(ptr: *mut T, len: usize) {
12941317
#[doc(hidden)]
12951318
#[stable(feature = "rust1", since = "1.0.0")]
12961319
pub fn from_elem<T: Clone>(elem: T, n: usize) -> Vec<T> {
1297-
unsafe {
1298-
let mut v = Vec::with_capacity(n);
1299-
let mut ptr = v.as_mut_ptr();
1300-
1301-
// Write all elements except the last one
1302-
for i in 1..n {
1303-
ptr::write(ptr, Clone::clone(&elem));
1304-
ptr = ptr.offset(1);
1305-
v.set_len(i); // Increment the length in every step in case Clone::clone() panics
1306-
}
1307-
1308-
if n > 0 {
1309-
// We can write the last element directly without cloning needlessly
1310-
ptr::write(ptr, elem);
1311-
v.set_len(n);
1312-
}
1313-
1314-
v
1315-
}
1320+
let mut v = Vec::with_capacity(n);
1321+
v.extend_with_element(n, elem);
1322+
v
13161323
}
13171324

13181325
////////////////////////////////////////////////////////////////////////////////

branches/stable/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>;

branches/stable/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

branches/stable/src/liblibc/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6431,6 +6431,7 @@ pub mod funcs {
64316431
}
64326432

64336433
#[doc(hidden)]
6434+
#[cfg(stage0)]
64346435
pub fn issue_14344_workaround() {} // FIXME #14344 force linkage to happen correctly
64356436

64366437
#[test] fn work_on_windows() { } // FIXME #10872 needed for a happy windows

branches/stable/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

branches/stable/src/librustc/metadata/encoder.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2136,11 +2136,7 @@ fn encode_metadata_inner(wr: &mut Cursor<Vec<u8>>,
21362136
let mut rbml_w = Encoder::new(wr);
21372137

21382138
encode_crate_name(&mut rbml_w, &ecx.link_meta.crate_name);
2139-
encode_crate_triple(&mut rbml_w,
2140-
&tcx.sess
2141-
.opts
2142-
.target_triple
2143-
);
2139+
encode_crate_triple(&mut rbml_w, &tcx.sess.opts.target_triple);
21442140
encode_hash(&mut rbml_w, &ecx.link_meta.crate_hash);
21452141
encode_dylib_dependency_formats(&mut rbml_w, &ecx);
21462142

0 commit comments

Comments
 (0)