Skip to content

Commit 9e8a982

Browse files
committed
Auto merge of rust-lang#56051 - pietroalbini:rollup, r=pietroalbini
Rollup of 25 pull requests Successful merges: - rust-lang#55562 (Add powerpc- and powerpc64-unknown-linux-musl targets) - rust-lang#55564 (test/linkage-visibility: Ignore on musl targets) - rust-lang#55827 (A few tweaks to iterations/collecting) - rust-lang#55834 (Forward the ABI of the non-zero sized fields of an union if they have the same ABI) - rust-lang#55857 (remove unused dependency) - rust-lang#55862 (in which the E0618 "expected function" diagnostic gets a makeover) - rust-lang#55867 (do not panic just because cargo failed) - rust-lang#55894 (miri enum discriminant handling: Fix treatment of pointers, better error when it is undef) - rust-lang#55916 (Make miri value visitor useful for mutation) - rust-lang#55919 (core/tests/num: Simplify `test_int_from_str_overflow()` test code) - rust-lang#55923 (reword #[test] attribute error on fn items) - rust-lang#55949 (ty: return impl Iterator from Predicate::walk_tys) - rust-lang#55952 (Update to Clang 7 on CI.) - rust-lang#55953 (rust-lang#53488 Refactoring UpvarId) - rust-lang#55962 (rustdoc: properly calculate spans for intra-doc link resolution errors) - rust-lang#55963 (Stress test for MPSC) - rust-lang#55968 (Clean up some non-mod-rs stuff.) - rust-lang#55970 (Miri backtrace improvements) - rust-lang#56007 (CTFE: dynamically make sure we do not call non-const-fn) - rust-lang#56011 (Replace data.clone() by Arc::clone(&data) in mutex doc.) - rust-lang#56012 (avoid shared ref in UnsafeCell::get) - rust-lang#56016 (Add VecDeque::resize_with) - rust-lang#56027 (docs: Add missing backtick in object_safety.rs docs) - rust-lang#56043 (remove "approx env bounds" if we already know from trait) - rust-lang#56059 (Increase `Duration` approximate equal threshold to 1us)
2 parents 7e82eda + 8cea658 commit 9e8a982

File tree

125 files changed

+1251
-591
lines changed

Some content is hidden

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

125 files changed

+1251
-591
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,9 @@ install:
227227
chmod +x /usr/local/bin/sccache &&
228228
travis_retry curl -fo /usr/local/bin/stamp https://s3-us-west-1.amazonaws.com/rust-lang-ci2/rust-ci-mirror/2017-03-17-stamp-x86_64-apple-darwin &&
229229
chmod +x /usr/local/bin/stamp &&
230-
travis_retry curl -f http://releases.llvm.org/6.0.0/clang+llvm-6.0.0-x86_64-apple-darwin.tar.xz | tar xJf - &&
231-
export CC=`pwd`/clang+llvm-6.0.0-x86_64-apple-darwin/bin/clang &&
232-
export CXX=`pwd`/clang+llvm-6.0.0-x86_64-apple-darwin/bin/clang++ &&
230+
travis_retry curl -f http://releases.llvm.org/7.0.0/clang+llvm-7.0.0-x86_64-apple-darwin.tar.xz | tar xJf - &&
231+
export CC=`pwd`/clang+llvm-7.0.0-x86_64-apple-darwin/bin/clang &&
232+
export CXX=`pwd`/clang+llvm-7.0.0-x86_64-apple-darwin/bin/clang++ &&
233233
export AR=ar
234234
;;
235235
esac

src/Cargo.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2191,7 +2191,6 @@ dependencies = [
21912191
"graphviz 0.0.0",
21922192
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
21932193
"parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
2194-
"parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
21952194
"rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
21962195
"rustc-rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
21972196
"rustc-rayon-core 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",

src/bootstrap/compile.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use std::fs::{self, File};
2222
use std::io::BufReader;
2323
use std::io::prelude::*;
2424
use std::path::{Path, PathBuf};
25-
use std::process::{Command, Stdio};
25+
use std::process::{Command, Stdio, exit};
2626
use std::str;
2727

2828
use build_helper::{output, mtime, up_to_date};
@@ -1098,7 +1098,7 @@ pub fn run_cargo(builder: &Builder,
10981098
});
10991099

11001100
if !ok {
1101-
panic!("cargo must succeed");
1101+
exit(1);
11021102
}
11031103

11041104
// Ok now we need to actually find all the files listed in `toplevel`. We've

src/ci/docker/dist-i686-linux/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ RUN ./build-gcc.sh
6767
COPY dist-x86_64-linux/build-python.sh /tmp/
6868
RUN ./build-python.sh
6969

70-
# Now build LLVM+Clang 6, afterwards configuring further compilations to use the
70+
# Now build LLVM+Clang 7, afterwards configuring further compilations to use the
7171
# clang/clang++ compilers.
7272
COPY dist-x86_64-linux/build-clang.sh /tmp/
7373
RUN ./build-clang.sh

src/ci/docker/dist-x86_64-linux/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ RUN ./build-gcc.sh
6767
COPY dist-x86_64-linux/build-python.sh /tmp/
6868
RUN ./build-python.sh
6969

70-
# Now build LLVM+Clang 6, afterwards configuring further compilations to use the
70+
# Now build LLVM+Clang 7, afterwards configuring further compilations to use the
7171
# clang/clang++ compilers.
7272
COPY dist-x86_64-linux/build-clang.sh /tmp/
7373
RUN ./build-clang.sh

src/ci/docker/dist-x86_64-linux/build-clang.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ set -ex
1313

1414
source shared.sh
1515

16-
LLVM=6.0.0
16+
LLVM=7.0.0
1717

1818
mkdir clang
1919
cd clang

src/ci/docker/scripts/musl.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ hide_output make clean
5151

5252
cd ..
5353

54-
LLVM=60
54+
LLVM=70
5555

5656
# may have been downloaded in a previous run
5757
if [ ! -d libunwind-release_$LLVM ]; then

src/liballoc/collections/vec_deque.rs

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
use core::cmp::Ordering;
2121
use core::fmt;
22-
use core::iter::{repeat, FromIterator, FusedIterator};
22+
use core::iter::{repeat, repeat_with, FromIterator, FusedIterator};
2323
use core::mem;
2424
use core::ops::Bound::{Excluded, Included, Unbounded};
2525
use core::ops::{Index, IndexMut, RangeBounds};
@@ -1920,6 +1920,44 @@ impl<T: Clone> VecDeque<T> {
19201920
self.truncate(new_len);
19211921
}
19221922
}
1923+
1924+
/// Modifies the `VecDeque` in-place so that `len()` is equal to `new_len`,
1925+
/// either by removing excess elements from the back or by appending
1926+
/// elements generated by calling `generator` to the back.
1927+
///
1928+
/// # Examples
1929+
///
1930+
/// ```
1931+
/// #![feature(vec_resize_with)]
1932+
///
1933+
/// use std::collections::VecDeque;
1934+
///
1935+
/// let mut buf = VecDeque::new();
1936+
/// buf.push_back(5);
1937+
/// buf.push_back(10);
1938+
/// buf.push_back(15);
1939+
/// assert_eq!(buf, [5, 10, 15]);
1940+
///
1941+
/// buf.resize_with(5, Default::default);
1942+
/// assert_eq!(buf, [5, 10, 15, 0, 0]);
1943+
///
1944+
/// buf.resize_with(2, || unreachable!());
1945+
/// assert_eq!(buf, [5, 10]);
1946+
///
1947+
/// let mut state = 100;
1948+
/// buf.resize_with(5, || { state += 1; state });
1949+
/// assert_eq!(buf, [5, 10, 101, 102, 103]);
1950+
/// ```
1951+
#[unstable(feature = "vec_resize_with", issue = "41758")]
1952+
pub fn resize_with(&mut self, new_len: usize, generator: impl FnMut()->T) {
1953+
let len = self.len();
1954+
1955+
if new_len > len {
1956+
self.extend(repeat_with(generator).take(new_len - len))
1957+
} else {
1958+
self.truncate(new_len);
1959+
}
1960+
}
19231961
}
19241962

19251963
/// Returns the index in the underlying buffer for a given logical element index.

src/libcore/cell.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1509,7 +1509,9 @@ impl<T: ?Sized> UnsafeCell<T> {
15091509
#[inline]
15101510
#[stable(feature = "rust1", since = "1.0.0")]
15111511
pub const fn get(&self) -> *mut T {
1512-
&self.value as *const T as *mut T
1512+
// We can just cast the pointer from `UnsafeCell<T>` to `T` because of
1513+
// #[repr(transparent)]
1514+
self as *const UnsafeCell<T> as *const T as *mut T
15131515
}
15141516
}
15151517

src/libcore/tests/num/mod.rs

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -82,36 +82,28 @@ fn from_str_issue7588() {
8282

8383
#[test]
8484
fn test_int_from_str_overflow() {
85-
let mut i8_val: i8 = 127;
86-
assert_eq!("127".parse::<i8>().ok(), Some(i8_val));
85+
assert_eq!("127".parse::<i8>().ok(), Some(127i8));
8786
assert_eq!("128".parse::<i8>().ok(), None);
8887

89-
i8_val = i8_val.wrapping_add(1);
90-
assert_eq!("-128".parse::<i8>().ok(), Some(i8_val));
88+
assert_eq!("-128".parse::<i8>().ok(), Some(-128i8));
9189
assert_eq!("-129".parse::<i8>().ok(), None);
9290

93-
let mut i16_val: i16 = 32_767;
94-
assert_eq!("32767".parse::<i16>().ok(), Some(i16_val));
91+
assert_eq!("32767".parse::<i16>().ok(), Some(32_767i16));
9592
assert_eq!("32768".parse::<i16>().ok(), None);
9693

97-
i16_val = i16_val.wrapping_add(1);
98-
assert_eq!("-32768".parse::<i16>().ok(), Some(i16_val));
94+
assert_eq!("-32768".parse::<i16>().ok(), Some(-32_768i16));
9995
assert_eq!("-32769".parse::<i16>().ok(), None);
10096

101-
let mut i32_val: i32 = 2_147_483_647;
102-
assert_eq!("2147483647".parse::<i32>().ok(), Some(i32_val));
97+
assert_eq!("2147483647".parse::<i32>().ok(), Some(2_147_483_647i32));
10398
assert_eq!("2147483648".parse::<i32>().ok(), None);
10499

105-
i32_val = i32_val.wrapping_add(1);
106-
assert_eq!("-2147483648".parse::<i32>().ok(), Some(i32_val));
100+
assert_eq!("-2147483648".parse::<i32>().ok(), Some(-2_147_483_648i32));
107101
assert_eq!("-2147483649".parse::<i32>().ok(), None);
108102

109-
let mut i64_val: i64 = 9_223_372_036_854_775_807;
110-
assert_eq!("9223372036854775807".parse::<i64>().ok(), Some(i64_val));
103+
assert_eq!("9223372036854775807".parse::<i64>().ok(), Some(9_223_372_036_854_775_807i64));
111104
assert_eq!("9223372036854775808".parse::<i64>().ok(), None);
112105

113-
i64_val = i64_val.wrapping_add(1);
114-
assert_eq!("-9223372036854775808".parse::<i64>().ok(), Some(i64_val));
106+
assert_eq!("-9223372036854775808".parse::<i64>().ok(), Some(-9_223_372_036_854_775_808i64));
115107
assert_eq!("-9223372036854775809".parse::<i64>().ok(), None);
116108
}
117109

0 commit comments

Comments
 (0)