Skip to content

Commit 9130e21

Browse files
committed
Auto merge of #57025 - pietroalbini:rollup, r=pietroalbini
Rollup of 20 pull requests Successful merges: - #56802 (Add DoubleEndedIterator::nth_back) - #56842 (Add unstable VecDeque::rotate_{left|right}) - #56869 (Reduce search-index.js size) - #56887 (Disable field reordering for repr(int).) - #56892 (rustc: Update Clang used to build LLVM on Linux) - #56909 (static eval: Do not ICE on layout size overflow) - #56914 (Ignore ui/target-feature-gate on sparc, sparc64, powerpc, powerpc64 and powerpc64le) - #56917 (Simplify MIR generation for logical operations) - #56919 (Remove a wrong multiplier on relocation offset computation) - #56933 (Add --progress to git submodule commands in x.py) - #56941 (deny intra-doc link resolution failures in libstd) - #56964 (Remove `TokenStream::JointTree`.) - #56970 (Mem uninit doc ptr drop) - #56973 (make basic CTFE tracing available on release builds) - #56979 (Adding unwinding support for x86_64_fortanix_unknown_sgx target.) - #56981 (miri: allocation is infallible) - #56984 (A few tweaks to dropck_outlives) - #56989 (Fix compiletest `trim` deprecation warnings) - #56992 (suggest similar lint names for unknown lints) - #57002 (Stabilize Vec(Deque)::resize_with) Failed merges: r? @ghost
2 parents 01c6ea2 + bc674ab commit 9130e21

Some content is hidden

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

60 files changed

+877
-284
lines changed

Cargo.lock

+3-3
Original file line numberDiff line numberDiff line change
@@ -1334,7 +1334,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
13341334

13351335
[[package]]
13361336
name = "minifier"
1337-
version = "0.0.20"
1337+
version = "0.0.21"
13381338
source = "registry+https://github.com/rust-lang/crates.io-index"
13391339
dependencies = [
13401340
"macro-utils 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2686,7 +2686,7 @@ dependencies = [
26862686
name = "rustdoc"
26872687
version = "0.0.0"
26882688
dependencies = [
2689-
"minifier 0.0.20 (registry+https://github.com/rust-lang/crates.io-index)",
2689+
"minifier 0.0.21 (registry+https://github.com/rust-lang/crates.io-index)",
26902690
"parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
26912691
"pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
26922692
"tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3502,7 +3502,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
35023502
"checksum memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0a3eb002f0535929f1199681417029ebea04aadc0c7a4224b46be99c7f5d6a16"
35033503
"checksum memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2ffa2c986de11a9df78620c01eeaaf27d94d3ff02bf81bfcca953102dd0c6ff"
35043504
"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3"
3505-
"checksum minifier 0.0.20 (registry+https://github.com/rust-lang/crates.io-index)" = "96c269bb45c39b333392b2b18ad71760b34ac65666591386b0e959ed58b3f474"
3505+
"checksum minifier 0.0.21 (registry+https://github.com/rust-lang/crates.io-index)" = "9707d0ff1b828cba09c4bb27d5c3dceb6f49bd46f700042343bea350a131bf4f"
35063506
"checksum miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0300eafb20369952951699b68243ab4334f4b10a88f411c221d444b36c40e649"
35073507
"checksum miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ad30a47319c16cde58d0314f5d98202a80c9083b5f61178457403dfb14e509c"
35083508
"checksum miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "28edaef377517fd9fe3e085c37d892ce7acd1fbeab9239c5a36eec352d8a8b7e"

src/bootstrap/bootstrap.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -678,10 +678,10 @@ def update_submodule(self, module, checked_out, recorded_submodules):
678678

679679
print("Updating submodule", module)
680680

681-
run(["git", "submodule", "-q", "sync", module],
681+
run(["git", "submodule", "-q", "sync", "--progress", module],
682682
cwd=self.rust_root, verbose=self.verbose)
683683
run(["git", "submodule", "update",
684-
"--init", "--recursive", module],
684+
"--init", "--recursive", "--progress", module],
685685
cwd=self.rust_root, verbose=self.verbose)
686686
run(["git", "reset", "-q", "--hard"],
687687
cwd=module_path, verbose=self.verbose)

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

+14-17
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,28 @@ set -ex
1313

1414
source shared.sh
1515

16-
LLVM=7.0.0
16+
# Currently these commits are all tip-of-tree as of 2018-12-16, used to pick up
17+
# a fix for rust-lang/rust#56849
18+
LLVM=032b00a5404865765cda7db3039f39d54964d8b0
19+
LLD=3e4aa4e8671523321af51449e0569f455ef3ad43
20+
CLANG=a6b9739069763243020f4ea6fe586bc135fde1f9
1721

1822
mkdir clang
1923
cd clang
2024

21-
curl https://releases.llvm.org/$LLVM/llvm-$LLVM.src.tar.xz | \
22-
xz -d | \
23-
tar xf -
24-
25-
cd llvm-$LLVM.src
25+
curl -L https://github.com/llvm-mirror/llvm/archive/$LLVM.tar.gz | \
26+
tar xzf - --strip-components=1
2627

2728
mkdir -p tools/clang
28-
29-
curl https://releases.llvm.org/$LLVM/cfe-$LLVM.src.tar.xz | \
30-
xz -d | \
31-
tar xf - -C tools/clang --strip-components=1
29+
curl -L https://github.com/llvm-mirror/clang/archive/$CLANG.tar.gz | \
30+
tar xzf - --strip-components=1 -C tools/clang
3231

3332
mkdir -p tools/lld
33+
curl -L https://github.com/llvm-mirror/lld/archive/$LLD.tar.gz | \
34+
tar zxf - --strip-components=1 -C tools/lld
3435

35-
curl https://releases.llvm.org/$LLVM/lld-$LLVM.src.tar.xz | \
36-
xz -d | \
37-
tar xf - -C tools/lld --strip-components=1
38-
39-
mkdir ../clang-build
40-
cd ../clang-build
36+
mkdir clang-build
37+
cd clang-build
4138

4239
# For whatever reason the default set of include paths for clang is different
4340
# than that of gcc. As a result we need to manually include our sysroot's
@@ -55,7 +52,7 @@ INC="$INC:/rustroot/lib/gcc/x86_64-unknown-linux-gnu/4.8.5/include-fixed"
5552
INC="$INC:/usr/include"
5653

5754
hide_output \
58-
cmake ../llvm-$LLVM.src \
55+
cmake .. \
5956
-DCMAKE_C_COMPILER=/rustroot/bin/gcc \
6057
-DCMAKE_CXX_COMPILER=/rustroot/bin/g++ \
6158
-DCMAKE_BUILD_TYPE=Release \

src/liballoc/collections/vec_deque.rs

+113-3
Original file line numberDiff line numberDiff line change
@@ -1897,8 +1897,6 @@ impl<T> VecDeque<T> {
18971897
/// # Examples
18981898
///
18991899
/// ```
1900-
/// #![feature(vec_resize_with)]
1901-
///
19021900
/// use std::collections::VecDeque;
19031901
///
19041902
/// let mut buf = VecDeque::new();
@@ -1917,7 +1915,7 @@ impl<T> VecDeque<T> {
19171915
/// buf.resize_with(5, || { state += 1; state });
19181916
/// assert_eq!(buf, [5, 10, 101, 102, 103]);
19191917
/// ```
1920-
#[unstable(feature = "vec_resize_with", issue = "41758")]
1918+
#[stable(feature = "vec_resize_with", since = "1.33.0")]
19211919
pub fn resize_with(&mut self, new_len: usize, generator: impl FnMut()->T) {
19221920
let len = self.len();
19231921

@@ -1927,6 +1925,118 @@ impl<T> VecDeque<T> {
19271925
self.truncate(new_len);
19281926
}
19291927
}
1928+
1929+
/// Rotates the double-ended queue `mid` places to the left.
1930+
///
1931+
/// Equivalently,
1932+
/// - Rotates item `mid` into the first position.
1933+
/// - Pops the first `mid` items and pushes them to the end.
1934+
/// - Rotates `len() - mid` places to the right.
1935+
///
1936+
/// # Panics
1937+
///
1938+
/// If `mid` is greater than `len()`. Note that `mid == len()`
1939+
/// does _not_ panic and is a no-op rotation.
1940+
///
1941+
/// # Complexity
1942+
///
1943+
/// Takes `O(min(mid, len() - mid))` time and no extra space.
1944+
///
1945+
/// # Examples
1946+
///
1947+
/// ```
1948+
/// #![feature(vecdeque_rotate)]
1949+
///
1950+
/// use std::collections::VecDeque;
1951+
///
1952+
/// let mut buf: VecDeque<_> = (0..10).collect();
1953+
///
1954+
/// buf.rotate_left(3);
1955+
/// assert_eq!(buf, [3, 4, 5, 6, 7, 8, 9, 0, 1, 2]);
1956+
///
1957+
/// for i in 1..10 {
1958+
/// assert_eq!(i * 3 % 10, buf[0]);
1959+
/// buf.rotate_left(3);
1960+
/// }
1961+
/// assert_eq!(buf, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
1962+
/// ```
1963+
#[unstable(feature = "vecdeque_rotate", issue = "56686")]
1964+
pub fn rotate_left(&mut self, mid: usize) {
1965+
assert!(mid <= self.len());
1966+
let k = self.len() - mid;
1967+
if mid <= k {
1968+
unsafe { self.rotate_left_inner(mid) }
1969+
} else {
1970+
unsafe { self.rotate_right_inner(k) }
1971+
}
1972+
}
1973+
1974+
/// Rotates the double-ended queue `k` places to the right.
1975+
///
1976+
/// Equivalently,
1977+
/// - Rotates the first item into position `k`.
1978+
/// - Pops the last `k` items and pushes them to the front.
1979+
/// - Rotates `len() - k` places to the left.
1980+
///
1981+
/// # Panics
1982+
///
1983+
/// If `k` is greater than `len()`. Note that `k == len()`
1984+
/// does _not_ panic and is a no-op rotation.
1985+
///
1986+
/// # Complexity
1987+
///
1988+
/// Takes `O(min(k, len() - k))` time and no extra space.
1989+
///
1990+
/// # Examples
1991+
///
1992+
/// ```
1993+
/// #![feature(vecdeque_rotate)]
1994+
///
1995+
/// use std::collections::VecDeque;
1996+
///
1997+
/// let mut buf: VecDeque<_> = (0..10).collect();
1998+
///
1999+
/// buf.rotate_right(3);
2000+
/// assert_eq!(buf, [7, 8, 9, 0, 1, 2, 3, 4, 5, 6]);
2001+
///
2002+
/// for i in 1..10 {
2003+
/// assert_eq!(0, buf[i * 3 % 10]);
2004+
/// buf.rotate_right(3);
2005+
/// }
2006+
/// assert_eq!(buf, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
2007+
/// ```
2008+
#[unstable(feature = "vecdeque_rotate", issue = "56686")]
2009+
pub fn rotate_right(&mut self, k: usize) {
2010+
assert!(k <= self.len());
2011+
let mid = self.len() - k;
2012+
if k <= mid {
2013+
unsafe { self.rotate_right_inner(k) }
2014+
} else {
2015+
unsafe { self.rotate_left_inner(mid) }
2016+
}
2017+
}
2018+
2019+
// Safety: the following two methods require that the rotation amount
2020+
// be less than half the length of the deque.
2021+
//
2022+
// `wrap_copy` requres that `min(x, cap() - x) + copy_len <= cap()`,
2023+
// but than `min` is never more than half the capacity, regardless of x,
2024+
// so it's sound to call here because we're calling with something
2025+
// less than half the length, which is never above half the capacity.
2026+
2027+
unsafe fn rotate_left_inner(&mut self, mid: usize) {
2028+
debug_assert!(mid * 2 <= self.len());
2029+
self.wrap_copy(self.head, self.tail, mid);
2030+
self.head = self.wrap_add(self.head, mid);
2031+
self.tail = self.wrap_add(self.tail, mid);
2032+
}
2033+
2034+
unsafe fn rotate_right_inner(&mut self, k: usize) {
2035+
debug_assert!(k * 2 <= self.len());
2036+
self.head = self.wrap_sub(self.head, k);
2037+
self.tail = self.wrap_sub(self.tail, k);
2038+
self.wrap_copy(self.tail, self.head, k);
2039+
}
19302040
}
19312041

19322042
impl<T: Clone> VecDeque<T> {

src/liballoc/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@
7272
test(no_crate_inject, attr(allow(unused_variables), deny(warnings))))]
7373
#![no_std]
7474
#![needs_allocator]
75+
76+
#![deny(intra_doc_link_resolution_failure)]
7577
#![deny(missing_debug_implementations)]
7678

7779
#![cfg_attr(not(test), feature(fn_traits))]

src/liballoc/rc.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,8 @@ unsafe impl<#[may_dangle] T: ?Sized> Drop for Rc<T> {
840840
/// drop(foo); // Doesn't print anything
841841
/// drop(foo2); // Prints "dropped!"
842842
/// ```
843+
///
844+
/// [`Weak`]: ../../std/rc/struct.Weak.html
843845
fn drop(&mut self) {
844846
unsafe {
845847
self.dec_strong();
@@ -1419,9 +1421,10 @@ impl<T: ?Sized + fmt::Debug> fmt::Debug for Weak<T> {
14191421
#[stable(feature = "downgraded_weak", since = "1.10.0")]
14201422
impl<T> Default for Weak<T> {
14211423
/// Constructs a new `Weak<T>`, allocating memory for `T` without initializing
1422-
/// it. Calling [`upgrade`][Weak::upgrade] on the return value always gives [`None`].
1424+
/// it. Calling [`upgrade`] on the return value always gives [`None`].
14231425
///
14241426
/// [`None`]: ../../std/option/enum.Option.html
1427+
/// [`upgrade`]: ../../std/rc/struct.Weak.html#method.upgrade
14251428
///
14261429
/// # Examples
14271430
///

src/liballoc/sync.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -952,6 +952,8 @@ unsafe impl<#[may_dangle] T: ?Sized> Drop for Arc<T> {
952952
/// drop(foo); // Doesn't print anything
953953
/// drop(foo2); // Prints "dropped!"
954954
/// ```
955+
///
956+
/// [`Weak`]: ../../std/sync/struct.Weak.html
955957
#[inline]
956958
fn drop(&mut self) {
957959
// Because `fetch_sub` is already atomic, we do not need to synchronize
@@ -1219,10 +1221,11 @@ impl<T: ?Sized> Clone for Weak<T> {
12191221
#[stable(feature = "downgraded_weak", since = "1.10.0")]
12201222
impl<T> Default for Weak<T> {
12211223
/// Constructs a new `Weak<T>`, without allocating memory.
1222-
/// Calling [`upgrade`][Weak::upgrade] on the return value always
1224+
/// Calling [`upgrade`] on the return value always
12231225
/// gives [`None`].
12241226
///
12251227
/// [`None`]: ../../std/option/enum.Option.html#variant.None
1228+
/// [`upgrade`]: ../../std/sync/struct.Weak.html#method.upgrade
12261229
///
12271230
/// # Examples
12281231
///

src/liballoc/tests/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
#![feature(drain_filter)]
1414
#![feature(exact_size_is_empty)]
1515
#![feature(pattern)]
16+
#![feature(repeat_generic_slice)]
1617
#![feature(slice_sort_by_cached_key)]
1718
#![feature(str_escape)]
1819
#![feature(try_reserve)]
1920
#![feature(unboxed_closures)]
20-
#![feature(repeat_generic_slice)]
21+
#![feature(vecdeque_rotate)]
2122

2223
extern crate core;
2324
extern crate rand;

0 commit comments

Comments
 (0)