Skip to content

Commit 13ff307

Browse files
authored
Auto merge of #35666 - eddyb:rollup, r=eddyb
Rollup of 30 pull requests - Successful merges: #34941, #35392, #35444, #35447, #35491, #35533, #35539, #35558, #35573, #35574, #35577, #35586, #35588, #35594, #35596, #35597, #35598, #35606, #35611, #35615, #35616, #35620, #35622, #35640, #35643, #35644, #35646, #35647, #35648, #35661 - Failed merges: #35395, #35415
2 parents 1d5b758 + bcee2ed commit 13ff307

File tree

127 files changed

+532
-217
lines changed

Some content is hidden

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

127 files changed

+532
-217
lines changed

configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ then
10131013
LLVM_VERSION=$($LLVM_CONFIG --version)
10141014

10151015
case $LLVM_VERSION in
1016-
(3.[7-8]*)
1016+
(3.[7-9]*)
10171017
msg "found ok version of LLVM: $LLVM_VERSION"
10181018
;;
10191019
(*)

mk/cfg/i586-unknown-linux-gnu.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ CFG_LIB_NAME_i586-unknown-linux-gnu=lib$(1).so
77
CFG_STATIC_LIB_NAME_i586-unknown-linux-gnu=lib$(1).a
88
CFG_LIB_GLOB_i586-unknown-linux-gnu=lib$(1)-*.so
99
CFG_LIB_DSYM_GLOB_i586-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
10-
CFG_JEMALLOC_CFLAGS_i586-unknown-linux-gnu := -m32 $(CFLAGS) -march=pentium
11-
CFG_GCCISH_CFLAGS_i586-unknown-linux-gnu := -g -fPIC -m32 $(CFLAGS) -march=pentium
10+
CFG_JEMALLOC_CFLAGS_i586-unknown-linux-gnu := -m32 $(CFLAGS) -march=pentium -Wa,-mrelax-relocations=no
11+
CFG_GCCISH_CFLAGS_i586-unknown-linux-gnu := -g -fPIC -m32 $(CFLAGS) -march=pentium -Wa,-mrelax-relocations=no
1212
CFG_GCCISH_CXXFLAGS_i586-unknown-linux-gnu := -fno-rtti $(CXXFLAGS) -march=pentium
1313
CFG_GCCISH_LINK_FLAGS_i586-unknown-linux-gnu := -shared -fPIC -ldl -pthread -lrt -g -m32
1414
CFG_GCCISH_DEF_FLAG_i586-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=

mk/cfg/i686-unknown-linux-musl.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ CFG_INSTALL_ONLY_RLIB_i686-unknown-linux-musl = 1
77
CFG_LIB_NAME_i686-unknown-linux-musl=lib$(1).so
88
CFG_STATIC_LIB_NAME_i686-unknown-linux-musl=lib$(1).a
99
CFG_LIB_GLOB_i686-unknown-linux-musl=lib$(1)-*.so
10-
CFG_JEMALLOC_CFLAGS_i686-unknown-linux-musl := -m32 -Wl,-melf_i386
11-
CFG_GCCISH_CFLAGS_i686-unknown-linux-musl := -g -fPIC -m32 -Wl,-melf_i386
10+
CFG_JEMALLOC_CFLAGS_i686-unknown-linux-musl := -m32 -Wl,-melf_i386 -Wa,-mrelax-relocations=no
11+
CFG_GCCISH_CFLAGS_i686-unknown-linux-musl := -g -fPIC -m32 -Wl,-melf_i386 -Wa,-mrelax-relocations=no
1212
CFG_GCCISH_CXXFLAGS_i686-unknown-linux-musl :=
1313
CFG_GCCISH_LINK_FLAGS_i686-unknown-linux-musl :=
1414
CFG_GCCISH_DEF_FLAG_i686-unknown-linux-musl :=

src/bootstrap/lib.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -870,8 +870,13 @@ impl Build {
870870
// This is a hack, because newer binutils broke things on some vms/distros
871871
// (i.e., linking against unknown relocs disabled by the following flag)
872872
// See: https://github.com/rust-lang/rust/issues/34978
873-
if target == "x86_64-unknown-linux-musl" {
874-
base.push("-Wa,-mrelax-relocations=no".into());
873+
match target {
874+
"i586-unknown-linux-gnu" |
875+
"i686-unknown-linux-musl" |
876+
"x86_64-unknown-linux-musl" => {
877+
base.push("-Wa,-mrelax-relocations=no".into());
878+
},
879+
_ => {},
875880
}
876881
return base
877882
}

src/bootstrap/sanity.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ pub fn check(build: &mut Build) {
9898
if target.contains("rumprun") ||
9999
target.contains("bitrig") ||
100100
target.contains("openbsd") ||
101-
target.contains("msvc") {
101+
target.contains("msvc") ||
102+
target.contains("emscripten") {
102103
build.config.use_jemalloc = false;
103104
}
104105

src/doc/book/error-handling.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ story. The other half is *using* the `find` function we've written. Let's try
166166
to use it to find the extension in a file name.
167167

168168
```rust
169-
# fn find(_: &str, _: char) -> Option<usize> { None }
169+
# fn find(haystack: &str, needle: char) -> Option<usize> { haystack.find(needle) }
170170
fn main() {
171171
let file_name = "foobar.rs";
172172
match find(file_name, '.') {
@@ -223,7 +223,7 @@ Getting the extension of a file name is a pretty common operation, so it makes
223223
sense to put it into a function:
224224

225225
```rust
226-
# fn find(_: &str, _: char) -> Option<usize> { None }
226+
# fn find(haystack: &str, needle: char) -> Option<usize> { haystack.find(needle) }
227227
// Returns the extension of the given file name, where the extension is defined
228228
// as all characters following the first `.`.
229229
// If `file_name` has no `.`, then `None` is returned.
@@ -272,7 +272,7 @@ Armed with our new combinator, we can rewrite our `extension_explicit` method
272272
to get rid of the case analysis:
273273

274274
```rust
275-
# fn find(_: &str, _: char) -> Option<usize> { None }
275+
# fn find(haystack: &str, needle: char) -> Option<usize> { haystack.find(needle) }
276276
// Returns the extension of the given file name, where the extension is defined
277277
// as all characters following the first `.`.
278278
// If `file_name` has no `.`, then `None` is returned.

src/doc/book/variable-bindings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ warning, but it will still print "Hello, world!":
125125

126126
```text
127127
Compiling hello_world v0.0.1 (file:///home/you/projects/hello_world)
128-
src/main.rs:2:9: 2:10 warning: unused variable: `x`, #[warn(unused_variable)]
128+
src/main.rs:2:9: 2:10 warning: unused variable: `x`, #[warn(unused_variables)]
129129
on by default
130130
src/main.rs:2 let x: i32;
131131
^

src/liballoc/raw_vec.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use super::boxed::Box;
1717
use core::ops::Drop;
1818
use core::cmp;
1919

20-
/// A low-level utility for more ergonomically allocating, reallocating, and deallocating a
20+
/// A low-level utility for more ergonomically allocating, reallocating, and deallocating
2121
/// a buffer of memory on the heap without having to worry about all the corner cases
2222
/// involved. This type is excellent for building your own data structures like Vec and VecDeque.
2323
/// In particular:
@@ -534,8 +534,8 @@ impl<T> RawVec<T> {
534534
/// Converts the entire buffer into `Box<[T]>`.
535535
///
536536
/// While it is not *strictly* Undefined Behavior to call
537-
/// this procedure while some of the RawVec is unintialized,
538-
/// it cetainly makes it trivial to trigger it.
537+
/// this procedure while some of the RawVec is uninitialized,
538+
/// it certainly makes it trivial to trigger it.
539539
///
540540
/// Note that this will correctly reconstitute any `cap` changes
541541
/// that may have been performed. (see description of type for details)

src/libcollections/string.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,7 +1152,7 @@ impl String {
11521152
self.vec.set_len(len + amt);
11531153
}
11541154

1155-
/// Inserts a string into this `String` at a byte position.
1155+
/// Inserts a string slice into this `String` at a byte position.
11561156
///
11571157
/// This is an `O(n)` operation as it requires copying every element in the
11581158
/// buffer.
@@ -1182,8 +1182,7 @@ impl String {
11821182
reason = "recent addition",
11831183
issue = "35553")]
11841184
pub fn insert_str(&mut self, idx: usize, string: &str) {
1185-
let len = self.len();
1186-
assert!(idx <= len);
1185+
assert!(idx <= self.len());
11871186
assert!(self.is_char_boundary(idx));
11881187

11891188
unsafe {

src/libcollections/vec.rs

Lines changed: 51 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,13 +1446,12 @@ impl<T> IntoIterator for Vec<T> {
14461446
#[inline]
14471447
fn into_iter(mut self) -> IntoIter<T> {
14481448
unsafe {
1449-
let ptr = self.as_mut_ptr();
1450-
assume(!ptr.is_null());
1451-
let begin = ptr as *const T;
1449+
let begin = self.as_mut_ptr();
1450+
assume(!begin.is_null());
14521451
let end = if mem::size_of::<T>() == 0 {
1453-
arith_offset(ptr as *const i8, self.len() as isize) as *const T
1452+
arith_offset(begin as *const i8, self.len() as isize) as *const T
14541453
} else {
1455-
ptr.offset(self.len() as isize) as *const T
1454+
begin.offset(self.len() as isize) as *const T
14561455
};
14571456
let buf = ptr::read(&self.buf);
14581457
mem::forget(self);
@@ -1710,10 +1709,52 @@ impl<'a, T> FromIterator<T> for Cow<'a, [T]> where T: Clone {
17101709
#[stable(feature = "rust1", since = "1.0.0")]
17111710
pub struct IntoIter<T> {
17121711
_buf: RawVec<T>,
1713-
ptr: *const T,
1712+
ptr: *mut T,
17141713
end: *const T,
17151714
}
17161715

1716+
impl<T> IntoIter<T> {
1717+
/// Returns the remaining items of this iterator as a slice.
1718+
///
1719+
/// # Examples
1720+
///
1721+
/// ```rust
1722+
/// # #![feature(vec_into_iter_as_slice)]
1723+
/// let vec = vec!['a', 'b', 'c'];
1724+
/// let mut into_iter = vec.into_iter();
1725+
/// assert_eq!(into_iter.as_slice(), &['a', 'b', 'c']);
1726+
/// let _ = into_iter.next().unwrap();
1727+
/// assert_eq!(into_iter.as_slice(), &['b', 'c']);
1728+
/// ```
1729+
#[unstable(feature = "vec_into_iter_as_slice", issue = "35601")]
1730+
pub fn as_slice(&self) -> &[T] {
1731+
unsafe {
1732+
slice::from_raw_parts(self.ptr, self.len())
1733+
}
1734+
}
1735+
1736+
/// Returns the remaining items of this iterator as a mutable slice.
1737+
///
1738+
/// # Examples
1739+
///
1740+
/// ```rust
1741+
/// # #![feature(vec_into_iter_as_slice)]
1742+
/// let vec = vec!['a', 'b', 'c'];
1743+
/// let mut into_iter = vec.into_iter();
1744+
/// assert_eq!(into_iter.as_slice(), &['a', 'b', 'c']);
1745+
/// into_iter.as_mut_slice()[2] = 'z';
1746+
/// assert_eq!(into_iter.next().unwrap(), 'a');
1747+
/// assert_eq!(into_iter.next().unwrap(), 'b');
1748+
/// assert_eq!(into_iter.next().unwrap(), 'z');
1749+
/// ```
1750+
#[unstable(feature = "vec_into_iter_as_slice", issue = "35601")]
1751+
pub fn as_mut_slice(&self) -> &mut [T] {
1752+
unsafe {
1753+
slice::from_raw_parts_mut(self.ptr, self.len())
1754+
}
1755+
}
1756+
}
1757+
17171758
#[stable(feature = "rust1", since = "1.0.0")]
17181759
unsafe impl<T: Send> Send for IntoIter<T> {}
17191760
#[stable(feature = "rust1", since = "1.0.0")]
@@ -1726,14 +1767,14 @@ impl<T> Iterator for IntoIter<T> {
17261767
#[inline]
17271768
fn next(&mut self) -> Option<T> {
17281769
unsafe {
1729-
if self.ptr == self.end {
1770+
if self.ptr as *const _ == self.end {
17301771
None
17311772
} else {
17321773
if mem::size_of::<T>() == 0 {
17331774
// purposefully don't use 'ptr.offset' because for
17341775
// vectors with 0-size elements this would return the
17351776
// same pointer.
1736-
self.ptr = arith_offset(self.ptr as *const i8, 1) as *const T;
1777+
self.ptr = arith_offset(self.ptr as *const i8, 1) as *mut T;
17371778

17381779
// Use a non-null pointer value
17391780
Some(ptr::read(EMPTY as *mut T))
@@ -1776,7 +1817,7 @@ impl<T> DoubleEndedIterator for IntoIter<T> {
17761817
} else {
17771818
if mem::size_of::<T>() == 0 {
17781819
// See above for why 'ptr.offset' isn't used
1779-
self.end = arith_offset(self.end as *const i8, -1) as *const T;
1820+
self.end = arith_offset(self.end as *const i8, -1) as *mut T;
17801821

17811822
// Use a non-null pointer value
17821823
Some(ptr::read(EMPTY as *mut T))
@@ -1796,9 +1837,7 @@ impl<T> ExactSizeIterator for IntoIter<T> {}
17961837
#[stable(feature = "vec_into_iter_clone", since = "1.8.0")]
17971838
impl<T: Clone> Clone for IntoIter<T> {
17981839
fn clone(&self) -> IntoIter<T> {
1799-
unsafe {
1800-
slice::from_raw_parts(self.ptr, self.len()).to_owned().into_iter()
1801-
}
1840+
self.as_slice().to_owned().into_iter()
18021841
}
18031842
}
18041843

0 commit comments

Comments
 (0)