Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 19 pull requests #57005

Closed
wants to merge 50 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
1bdd6ca
retrieve ty info from place_ty
csmoe Dec 15, 2018
7f9883d
Add unstable VecDeque::rotate_{left|right}
scottmcm Dec 15, 2018
9ca2902
update test
csmoe Dec 15, 2018
c4fa1d2
stop treating trait objects from #[fundamental] traits as fundamental
arielb1 Dec 15, 2018
0815531
Add a note about why the unsafe is sound
scottmcm Dec 16, 2018
bf4a984
Reduce search-index.js size
GuillaumeGomez Dec 16, 2018
fba23d0
Disable field reordering for repr(int).
emilio Dec 16, 2018
d84bdba
Add test to check order of repr(int) enum fields
petertodd Dec 8, 2018
bbce189
rustc: Update Clang used to build LLVM on LInux
alexcrichton Dec 16, 2018
a2b6401
Issue 56905
blitzerr Dec 17, 2018
37c3561
describe index with accurate _
csmoe Dec 17, 2018
b31a1f7
Fix a recently introduces regression
oli-obk Dec 17, 2018
7e2e489
Also test projections
oli-obk Dec 17, 2018
3e7a4ca
Remove a wrong multiplier on relocation offset computation
oli-obk Dec 17, 2018
e7e17f9
static eval: Do not ICE on layout size overflow
dlrobertson Dec 17, 2018
6130fc8
Add --progress to git submodule commands
clarfonthey Dec 17, 2018
50eb5f6
Explain the math
oli-obk Dec 18, 2018
170f068
Don't render const keyword on stable
GuillaumeGomez Oct 24, 2018
00bd306
Extend documentation for mem uninit to discuss partial allocation of …
Firstyear Dec 19, 2018
0829d0c
Updates based on comment
Firstyear Dec 19, 2018
d751954
Creating the vector using with_capacity to avoid re-allocation later …
blitzerr Dec 19, 2018
cbe9abb
Add more VecDeque::rotate_{left|right} tests
scottmcm Dec 19, 2018
a6943d9
Set constness correctly
GuillaumeGomez Dec 18, 2018
b2d8040
Fix tidy error
Firstyear Dec 19, 2018
202904b
make basic CTFE tracing available on release builds
RalfJung Dec 19, 2018
885cf2a
Adding unwinding support for x86_64_fortanix_unknown_sgx target.
Dec 14, 2018
818ed69
dropck: simplify common patterns
ljedrz Dec 19, 2018
ae3f6b0
dropck: remove unnecessary call to cloned()
ljedrz Dec 19, 2018
7eb67c2
test: Ignore ui/target-feature-gate on powerpc and powerpc64(le)
glaubitz Dec 19, 2018
a153d48
test: Ignore ui/target-feature-gate on sparc and sparc64
glaubitz Dec 19, 2018
036ce5c
Fix compiletest `trim` deprecation warnings
phansch Dec 19, 2018
7b70b0b
Rollup merge of #56842 - scottmcm:vecdeque-rotate, r=alexcrichton
pietroalbini Dec 20, 2018
063e4a2
Rollup merge of #56843 - csmoe:non-copy, r=davidtwco
pietroalbini Dec 20, 2018
80bc55b
Rollup merge of #56845 - GuillaumeGomez:const-docs, r=oli-obk
pietroalbini Dec 20, 2018
234c340
Rollup merge of #56862 - arielb1:fundamentally-clean, r=nikomatsakis
pietroalbini Dec 20, 2018
7c7e21a
Rollup merge of #56869 - GuillaumeGomez:index-size-reduction, r=Quiet…
pietroalbini Dec 20, 2018
e12e472
Rollup merge of #56887 - emilio:enum-field-reordering, r=eddyb
pietroalbini Dec 20, 2018
e801ffa
Rollup merge of #56892 - alexcrichton:new-llvm, r=michaelwoerister
pietroalbini Dec 20, 2018
f46a757
Rollup merge of #56906 - blitzerr:master, r=nikomatsakis
pietroalbini Dec 20, 2018
7b61ef3
Rollup merge of #56909 - dlrobertson:fix_56762, r=estebank
pietroalbini Dec 20, 2018
7429367
Rollup merge of #56914 - glaubitz:ignore-tests, r=alexcrichton
pietroalbini Dec 20, 2018
5ecc80a
Rollup merge of #56916 - oli-obk:static_mut_beta_regression, r=davidtwco
pietroalbini Dec 20, 2018
d96be3d
Rollup merge of #56919 - oli-obk:null_ref_array_tuple, r=RalfJung
pietroalbini Dec 20, 2018
5a118d4
Rollup merge of #56933 - clarcharr:xpy_progress, r=Mark-Simulacrum
pietroalbini Dec 20, 2018
3fa6672
Rollup merge of #56954 - hug-dev:armv8m-main-ci, r=alexcrichton
pietroalbini Dec 20, 2018
bfb4cce
Rollup merge of #56970 - Firstyear:mem_uninit_doc_ptr_drop, r=Manishe…
pietroalbini Dec 20, 2018
3b15bd2
Rollup merge of #56973 - RalfJung:miri-trace, r=oli-obk
pietroalbini Dec 20, 2018
04e51eb
Rollup merge of #56979 - VardhanThigle:Vardhan/rust-sgx-unwind-suppor…
pietroalbini Dec 20, 2018
b2207e2
Rollup merge of #56984 - ljedrz:dropck_outlives_tweaks, r=oli-obk
pietroalbini Dec 20, 2018
0880d95
Rollup merge of #56989 - phansch:fix_compiletest_trim_deprecations, r…
pietroalbini Dec 20, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1334,7 +1334,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "minifier"
version = "0.0.20"
version = "0.0.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"macro-utils 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
Expand Down Expand Up @@ -2686,7 +2686,7 @@ dependencies = [
name = "rustdoc"
version = "0.0.0"
dependencies = [
"minifier 0.0.20 (registry+https://github.com/rust-lang/crates.io-index)",
"minifier 0.0.21 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
Expand Down Expand Up @@ -3502,7 +3502,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0a3eb002f0535929f1199681417029ebea04aadc0c7a4224b46be99c7f5d6a16"
"checksum memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2ffa2c986de11a9df78620c01eeaaf27d94d3ff02bf81bfcca953102dd0c6ff"
"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3"
"checksum minifier 0.0.20 (registry+https://github.com/rust-lang/crates.io-index)" = "96c269bb45c39b333392b2b18ad71760b34ac65666591386b0e959ed58b3f474"
"checksum minifier 0.0.21 (registry+https://github.com/rust-lang/crates.io-index)" = "9707d0ff1b828cba09c4bb27d5c3dceb6f49bd46f700042343bea350a131bf4f"
"checksum miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0300eafb20369952951699b68243ab4334f4b10a88f411c221d444b36c40e649"
"checksum miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ad30a47319c16cde58d0314f5d98202a80c9083b5f61178457403dfb14e509c"
"checksum miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "28edaef377517fd9fe3e085c37d892ce7acd1fbeab9239c5a36eec352d8a8b7e"
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,10 +678,10 @@ def update_submodule(self, module, checked_out, recorded_submodules):

print("Updating submodule", module)

run(["git", "submodule", "-q", "sync", module],
run(["git", "submodule", "-q", "sync", "--progress", module],
cwd=self.rust_root, verbose=self.verbose)
run(["git", "submodule", "update",
"--init", "--recursive", module],
"--init", "--recursive", "--progress", module],
cwd=self.rust_root, verbose=self.verbose)
run(["git", "reset", "-q", "--hard"],
cwd=module_path, verbose=self.verbose)
Expand Down
1 change: 1 addition & 0 deletions src/ci/docker/dist-various-1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ ENV TARGETS=$TARGETS,thumbv6m-none-eabi
ENV TARGETS=$TARGETS,thumbv7m-none-eabi
ENV TARGETS=$TARGETS,thumbv7em-none-eabi
ENV TARGETS=$TARGETS,thumbv7em-none-eabihf
ENV TARGETS=$TARGETS,thumbv8m.main-none-eabi
ENV TARGETS=$TARGETS,riscv32imc-unknown-none-elf
ENV TARGETS=$TARGETS,riscv32imac-unknown-none-elf
ENV TARGETS=$TARGETS,armebv7r-none-eabi
Expand Down
31 changes: 14 additions & 17 deletions src/ci/docker/dist-x86_64-linux/build-clang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,28 @@ set -ex

source shared.sh

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

mkdir clang
cd clang

curl https://releases.llvm.org/$LLVM/llvm-$LLVM.src.tar.xz | \
xz -d | \
tar xf -

cd llvm-$LLVM.src
curl -L https://github.com/llvm-mirror/llvm/archive/$LLVM.tar.gz | \
tar xzf - --strip-components=1

mkdir -p tools/clang

curl https://releases.llvm.org/$LLVM/cfe-$LLVM.src.tar.xz | \
xz -d | \
tar xf - -C tools/clang --strip-components=1
curl -L https://github.com/llvm-mirror/clang/archive/$CLANG.tar.gz | \
tar xzf - --strip-components=1 -C tools/clang

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

curl https://releases.llvm.org/$LLVM/lld-$LLVM.src.tar.xz | \
xz -d | \
tar xf - -C tools/lld --strip-components=1

mkdir ../clang-build
cd ../clang-build
mkdir clang-build
cd clang-build

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

hide_output \
cmake ../llvm-$LLVM.src \
cmake .. \
-DCMAKE_C_COMPILER=/rustroot/bin/gcc \
-DCMAKE_CXX_COMPILER=/rustroot/bin/g++ \
-DCMAKE_BUILD_TYPE=Release \
Expand Down
112 changes: 112 additions & 0 deletions src/liballoc/collections/vec_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1927,6 +1927,118 @@ impl<T> VecDeque<T> {
self.truncate(new_len);
}
}

/// Rotates the double-ended queue `mid` places to the left.
///
/// Equivalently,
/// - Rotates item `mid` into the first position.
/// - Pops the first `mid` items and pushes them to the end.
/// - Rotates `len() - mid` places to the right.
///
/// # Panics
///
/// If `mid` is greater than `len()`. Note that `mid == len()`
/// does _not_ panic and is a no-op rotation.
///
/// # Complexity
///
/// Takes `O(min(mid, len() - mid))` time and no extra space.
///
/// # Examples
///
/// ```
/// #![feature(vecdeque_rotate)]
///
/// use std::collections::VecDeque;
///
/// let mut buf: VecDeque<_> = (0..10).collect();
///
/// buf.rotate_left(3);
/// assert_eq!(buf, [3, 4, 5, 6, 7, 8, 9, 0, 1, 2]);
///
/// for i in 1..10 {
/// assert_eq!(i * 3 % 10, buf[0]);
/// buf.rotate_left(3);
/// }
/// assert_eq!(buf, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
/// ```
#[unstable(feature = "vecdeque_rotate", issue = "56686")]
pub fn rotate_left(&mut self, mid: usize) {
assert!(mid <= self.len());
let k = self.len() - mid;
if mid <= k {
unsafe { self.rotate_left_inner(mid) }
} else {
unsafe { self.rotate_right_inner(k) }
}
}

/// Rotates the double-ended queue `k` places to the right.
///
/// Equivalently,
/// - Rotates the first item into position `k`.
/// - Pops the last `k` items and pushes them to the front.
/// - Rotates `len() - k` places to the left.
///
/// # Panics
///
/// If `k` is greater than `len()`. Note that `k == len()`
/// does _not_ panic and is a no-op rotation.
///
/// # Complexity
///
/// Takes `O(min(k, len() - k))` time and no extra space.
///
/// # Examples
///
/// ```
/// #![feature(vecdeque_rotate)]
///
/// use std::collections::VecDeque;
///
/// let mut buf: VecDeque<_> = (0..10).collect();
///
/// buf.rotate_right(3);
/// assert_eq!(buf, [7, 8, 9, 0, 1, 2, 3, 4, 5, 6]);
///
/// for i in 1..10 {
/// assert_eq!(0, buf[i * 3 % 10]);
/// buf.rotate_right(3);
/// }
/// assert_eq!(buf, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
/// ```
#[unstable(feature = "vecdeque_rotate", issue = "56686")]
pub fn rotate_right(&mut self, k: usize) {
assert!(k <= self.len());
let mid = self.len() - k;
if k <= mid {
unsafe { self.rotate_right_inner(k) }
} else {
unsafe { self.rotate_left_inner(mid) }
}
}

// Safety: the following two methods require that the rotation amount
// be less than half the length of the deque.
//
// `wrap_copy` requres that `min(x, cap() - x) + copy_len <= cap()`,
// but than `min` is never more than half the capacity, regardless of x,
// so it's sound to call here because we're calling with something
// less than half the length, which is never above half the capacity.

unsafe fn rotate_left_inner(&mut self, mid: usize) {
debug_assert!(mid * 2 <= self.len());
self.wrap_copy(self.head, self.tail, mid);
self.head = self.wrap_add(self.head, mid);
self.tail = self.wrap_add(self.tail, mid);
}

unsafe fn rotate_right_inner(&mut self, k: usize) {
debug_assert!(k * 2 <= self.len());
self.head = self.wrap_sub(self.head, k);
self.tail = self.wrap_sub(self.tail, k);
self.wrap_copy(self.tail, self.head, k);
}
}

impl<T: Clone> VecDeque<T> {
Expand Down
3 changes: 2 additions & 1 deletion src/liballoc/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
#![feature(drain_filter)]
#![feature(exact_size_is_empty)]
#![feature(pattern)]
#![feature(repeat_generic_slice)]
#![feature(slice_sort_by_cached_key)]
#![feature(str_escape)]
#![feature(try_reserve)]
#![feature(unboxed_closures)]
#![feature(repeat_generic_slice)]
#![feature(vecdeque_rotate)]

extern crate core;
extern crate rand;
Expand Down
134 changes: 134 additions & 0 deletions src/liballoc/tests/vec_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1309,3 +1309,137 @@ fn test_try_reserve_exact() {
}

}

#[test]
fn test_rotate_nop() {
let mut v: VecDeque<_> = (0..10).collect();
assert_unchanged(&v);

v.rotate_left(0);
assert_unchanged(&v);

v.rotate_left(10);
assert_unchanged(&v);

v.rotate_right(0);
assert_unchanged(&v);

v.rotate_right(10);
assert_unchanged(&v);

v.rotate_left(3);
v.rotate_right(3);
assert_unchanged(&v);

v.rotate_right(3);
v.rotate_left(3);
assert_unchanged(&v);

v.rotate_left(6);
v.rotate_right(6);
assert_unchanged(&v);

v.rotate_right(6);
v.rotate_left(6);
assert_unchanged(&v);

v.rotate_left(3);
v.rotate_left(7);
assert_unchanged(&v);

v.rotate_right(4);
v.rotate_right(6);
assert_unchanged(&v);

v.rotate_left(1);
v.rotate_left(2);
v.rotate_left(3);
v.rotate_left(4);
assert_unchanged(&v);

v.rotate_right(1);
v.rotate_right(2);
v.rotate_right(3);
v.rotate_right(4);
assert_unchanged(&v);

fn assert_unchanged(v: &VecDeque<i32>) {
assert_eq!(v, &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
}
}

#[test]
fn test_rotate_left_parts() {
let mut v: VecDeque<_> = (1..=7).collect();
v.rotate_left(2);
assert_eq!(v.as_slices(), (&[3, 4, 5, 6, 7, 1][..], &[2][..]));
v.rotate_left(2);
assert_eq!(v.as_slices(), (&[5, 6, 7, 1][..], &[2, 3, 4][..]));
v.rotate_left(2);
assert_eq!(v.as_slices(), (&[7, 1][..], &[2, 3, 4, 5, 6][..]));
v.rotate_left(2);
assert_eq!(v.as_slices(), (&[2, 3, 4, 5, 6, 7, 1][..], &[][..]));
v.rotate_left(2);
assert_eq!(v.as_slices(), (&[4, 5, 6, 7, 1, 2][..], &[3][..]));
v.rotate_left(2);
assert_eq!(v.as_slices(), (&[6, 7, 1, 2][..], &[3, 4, 5][..]));
v.rotate_left(2);
assert_eq!(v.as_slices(), (&[1, 2][..], &[3, 4, 5, 6, 7][..]));
}

#[test]
fn test_rotate_right_parts() {
let mut v: VecDeque<_> = (1..=7).collect();
v.rotate_right(2);
assert_eq!(v.as_slices(), (&[6, 7][..], &[1, 2, 3, 4, 5][..]));
v.rotate_right(2);
assert_eq!(v.as_slices(), (&[4, 5, 6, 7][..], &[1, 2, 3][..]));
v.rotate_right(2);
assert_eq!(v.as_slices(), (&[2, 3, 4, 5, 6, 7][..], &[1][..]));
v.rotate_right(2);
assert_eq!(v.as_slices(), (&[7, 1, 2, 3, 4, 5, 6][..], &[][..]));
v.rotate_right(2);
assert_eq!(v.as_slices(), (&[5, 6][..], &[7, 1, 2, 3, 4][..]));
v.rotate_right(2);
assert_eq!(v.as_slices(), (&[3, 4, 5, 6][..], &[7, 1, 2][..]));
v.rotate_right(2);
assert_eq!(v.as_slices(), (&[1, 2, 3, 4, 5, 6][..], &[7][..]));
}

#[test]
fn test_rotate_left_random() {
let shifts = [
6, 1, 0, 11, 12, 1, 11, 7, 9, 3, 6, 1,
4, 0, 5, 1, 3, 1, 12, 8, 3, 1, 11, 11,
9, 4, 12, 3, 12, 9, 11, 1, 7, 9, 7, 2,
];
let n = 12;
let mut v: VecDeque<_> = (0..n).collect();
let mut total_shift = 0;
for shift in shifts.iter().cloned() {
v.rotate_left(shift);
total_shift += shift;
for i in 0..n {
assert_eq!(v[i], (i + total_shift) % n);
}
}
}

#[test]
fn test_rotate_right_random() {
let shifts = [
6, 1, 0, 11, 12, 1, 11, 7, 9, 3, 6, 1,
4, 0, 5, 1, 3, 1, 12, 8, 3, 1, 11, 11,
9, 4, 12, 3, 12, 9, 11, 1, 7, 9, 7, 2,
];
let n = 12;
let mut v: VecDeque<_> = (0..n).collect();
let mut total_shift = 0;
for shift in shifts.iter().cloned() {
v.rotate_right(shift);
total_shift += shift;
for i in 0..n {
assert_eq!(v[(i + total_shift) % n], i);
}
}
}
Loading