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 41 pull requests #57058

Closed
wants to merge 125 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
5f34316
simplify deprecation and stability rendering
euclio Dec 14, 2018
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
37c3561
describe index with accurate _
csmoe Dec 17, 2018
e38e954
Simplify MIR generation for logical ops
sinkuu 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
e36b628
rename div_euc -> div_euclid, and mod_euc -> rem_euclid
ubsan Dec 18, 2018
82e55c1
deny intra-doc link resolution failures in libstd
euclio Dec 18, 2018
de39aea
fix tests
ubsan Dec 18, 2018
50eb5f6
Explain the math
oli-obk Dec 18, 2018
f731445
Mark tuple structs as live if their constructors are used
oli-obk Dec 18, 2018
fe91892
Update Pin API to match the one proposed for stabilization
cramertj Dec 18, 2018
987a5e4
Stabilize Pin
cramertj Dec 18, 2018
80059df
Pin stabilization: fix doctests
cramertj Dec 18, 2018
9229488
Rename Box/Arc/Rc::pinned to ::pin
cramertj Dec 18, 2018
46a4ff6
Fix Unpin docs link
cramertj Dec 18, 2018
3d8a066
Replace current crate's searchIndex when regenerating
GuillaumeGomez Dec 18, 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
3773ae2
FIXME(45827) remove comment since errors are reported
nivkner Dec 17, 2018
cf329d5
FIXME(49821) remove fixme since a tip about let binding is given
nivkner Dec 17, 2018
7092fca
FIXME(44217) remove fixme because the allocator logic was removed, bu…
nivkner Dec 17, 2018
cc568e7
FIXME(49824) remove fixme because there is no free region error anymore
nivkner Dec 17, 2018
e06b81e
FIXME(21232) update fixme to point to the open issue about accepting …
nivkner Dec 17, 2018
aedbe9a
FIXME(31702) remove fixme, move auxiliaries to the right place and fi…
nivkner Dec 17, 2018
b1db8f8
FIXME(45992) remove fixme since the lint is being tested
nivkner Dec 18, 2018
5d7fad3
FIXME(47184) update fixmes to point to issues specific to them
nivkner Dec 18, 2018
8680824
FIXME(2665) remove fixme since the c files are included by the testsuite
nivkner Dec 18, 2018
1aaad19
FIXME(RFC1868) point the fixme to the tracking issue
nivkner Dec 18, 2018
897c182
FIXME(52456) remove fixme and combine all extern items in one block
nivkner Dec 18, 2018
d88d319
FIXME(53451) remove fixme and unnecessary pubs
nivkner Dec 18, 2018
cbe9abb
Add more VecDeque::rotate_{left|right} tests
scottmcm Dec 19, 2018
957a9c7
Revert "FIXME(53451) remove fixme and unnecessary pubs"
nivkner Dec 19, 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
81a45e2
miri: allocation is infallible
RalfJung Dec 19, 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
0e72c80
FIXME(9639) remove fixme and accept non-utf8 paths in compiletest
nivkner Dec 17, 2018
7894717
FIXME(9639) remove fixme and accept non-utf8 paths in librustdoc
nivkner Dec 19, 2018
90726e1
suggest similar lint names for unknown lints
euclio Dec 19, 2018
e7c5146
Remove `TokenStream::JointTree`.
nnethercote Dec 19, 2018
7b6cf6e
Stabilize Vec(Deque)::resize_with
scottmcm Dec 20, 2018
fb18dda
Add DoubleEndedIterator::nth_back
clarfonthey Dec 14, 2018
66bb34c
Update src/libcore/num/mod.rs
dtolnay Dec 20, 2018
455bc95
fix nits
ubsan Dec 20, 2018
405d8b0
Copyrite
oli-obk Dec 20, 2018
0b0a00c
new --static-root-path flag for controlling static file locations
QuietMisdreavus Dec 20, 2018
8dc8d7a
split extra_scripts to handle root_path shenanigans
QuietMisdreavus Dec 20, 2018
8d393bf
display rustc_private APIs as "Internal"
euclio Dec 13, 2018
49f5106
AST/HIR: Introduce `ExprKind::Err` for better error recovery in the f…
petrochenkov Dec 17, 2018
cc2b08d
Do not abort compilation if expansion produces errors
petrochenkov Dec 16, 2018
577427e
Get rid of `Block::recovered`
petrochenkov Dec 19, 2018
a053ae2
Fix `trace_macros` and `log_syntax`
petrochenkov Dec 20, 2018
db24d8e
Enable emission of alignment attrs for pointer params
nikic Dec 20, 2018
29f3d7b
Make sure feature gate errors are recoverable
petrochenkov Dec 20, 2018
4a6aa36
Address review comments and CI failures
petrochenkov Dec 20, 2018
edd08e0
Optimize away a move
Zoxc Dec 6, 2018
86e63ba
Remove QueryResult
Zoxc Dec 7, 2018
f8e508c
Fix a recently introduces regression
oli-obk Dec 17, 2018
b9d74fc
Also test projections
oli-obk Dec 17, 2018
3414be0
fix deprecation warnings in liballoc benches
RalfJung Dec 21, 2018
4f30a24
Inline tweaks
Zoxc Dec 5, 2018
6ed596e
Update tests to changes on master
oli-obk Dec 21, 2018
8c40aed
Fix feature gate to point to 1.32.0 for `path_from_str`
otavio Dec 21, 2018
87c8cdd
Stabilize #[repr(packed(N))]
cramertj Dec 21, 2018
e5e19d9
Remove unstable-book repr-packed entry
cramertj Dec 21, 2018
51e4c1f
Fixed typo in HashMap documentation
RyanMarcus Dec 21, 2018
34dc5c8
macro_literal_matcher was stabilized in 1.32; not 1.32.
Centril Dec 21, 2018
0203a1c
exhaustive_integer_patterns slipped 1.32; stabilized in 1.33.
Centril Dec 21, 2018
097d39d
Fix alignment for array indexing
nikic Dec 21, 2018
80c398b
Rollup merge of #56802 - clarcharr:nth_back, r=alexcrichton
Centril Dec 22, 2018
812576f
Rollup merge of #56824 - euclio:internal-apis, r=QuietMisdreavus
Centril Dec 22, 2018
8f2473e
Rollup merge of #56842 - scottmcm:vecdeque-rotate, r=alexcrichton
Centril Dec 22, 2018
e0fb972
Rollup merge of #56843 - csmoe:non-copy, r=davidtwco
Centril Dec 22, 2018
06b0f46
Rollup merge of #56862 - arielb1:fundamentally-clean, r=nikomatsakis
Centril Dec 22, 2018
0d26ce9
Rollup merge of #56869 - GuillaumeGomez:index-size-reduction, r=Quiet…
Centril Dec 22, 2018
ff6efb6
Rollup merge of #56887 - emilio:enum-field-reordering, r=eddyb
Centril Dec 22, 2018
c2ed5cc
Rollup merge of #56892 - alexcrichton:new-llvm, r=michaelwoerister
Centril Dec 22, 2018
e480450
Rollup merge of #56909 - dlrobertson:fix_56762, r=estebank
Centril Dec 22, 2018
88fbd9f
Rollup merge of #56914 - glaubitz:ignore-tests, r=alexcrichton
Centril Dec 22, 2018
3627261
Rollup merge of #56916 - oli-obk:static_mut_beta_regression, r=davidtwco
Centril Dec 22, 2018
95354fa
Rollup merge of #56917 - sinkuu:mir_build_logicop, r=davidtwco
Centril Dec 22, 2018
a4b32df
Rollup merge of #56919 - oli-obk:null_ref_array_tuple, r=RalfJung
Centril Dec 22, 2018
0f6ea43
Rollup merge of #56933 - clarcharr:xpy_progress, r=Mark-Simulacrum
Centril Dec 22, 2018
c85da26
Rollup merge of #56936 - ubsan:euclidean_div_rem, r=dtolnay
Centril Dec 22, 2018
10228bc
Rollup merge of #56939 - cramertj:pin-stabilization, r=alexcrichton
Centril Dec 22, 2018
ef6ce65
Rollup merge of #56941 - euclio:deny-libstd-resolution-failures, r=Qu…
Centril Dec 22, 2018
4481656
Rollup merge of #56953 - oli-obk:dead_const, r=petrochenkov
Centril Dec 22, 2018
6e267fb
Rollup merge of #56962 - nivkner:fixme_fixup4, r=pnkfelix
Centril Dec 22, 2018
4665a4b
Rollup merge of #56964 - nnethercote:TokenStream-IsJoint, r=petrochenkov
Centril Dec 22, 2018
e457c85
Rollup merge of #56967 - GuillaumeGomez:regen-search-index, r=QuietMi…
Centril Dec 22, 2018
0181d5b
Rollup merge of #56970 - Firstyear:mem_uninit_doc_ptr_drop, r=Manishe…
Centril Dec 22, 2018
8b0bcca
Rollup merge of #56973 - RalfJung:miri-trace, r=oli-obk
Centril Dec 22, 2018
bd12d8f
Rollup merge of #56979 - VardhanThigle:Vardhan/rust-sgx-unwind-suppor…
Centril Dec 22, 2018
132f477
Rollup merge of #56981 - RalfJung:miri-infallible-alloc, r=oli-obk
Centril Dec 22, 2018
f62dabd
Rollup merge of #56984 - ljedrz:dropck_outlives_tweaks, r=oli-obk
Centril Dec 22, 2018
4111c44
Rollup merge of #56989 - phansch:fix_compiletest_trim_deprecations, r…
Centril Dec 22, 2018
cdc8d46
Rollup merge of #56992 - euclio:unknown-lint-suggestion, r=oli-obk
Centril Dec 22, 2018
e36e427
Rollup merge of #56999 - petrochenkov:macrecov2, r=estebank
Centril Dec 22, 2018
edeae30
Rollup merge of #57002 - scottmcm:stabilize-resize_with, r=rkruppe
Centril Dec 22, 2018
06fa9cc
Rollup merge of #57011 - QuietMisdreavus:static-root-path, r=Guillaum…
Centril Dec 22, 2018
9ef6127
Rollup merge of #57021 - nikic:arg-pointer-align, r=nagisa
Centril Dec 22, 2018
f9eddb9
Rollup merge of #57027 - Zoxc:query-perf5, r=michaelwoerister
Centril Dec 22, 2018
d2ffa55
Rollup merge of #57031 - Zoxc:query-perf7, r=michaelwoerister
Centril Dec 22, 2018
7429dad
Rollup merge of #57032 - RalfJung:alloc-bench-deprecations, r=Centril
Centril Dec 22, 2018
bff1363
Rollup merge of #57034 - Zoxc:query-perf8, r=michaelwoerister
Centril Dec 22, 2018
87a0202
Rollup merge of #57040 - otavio:topic/adjust-path_from_str-feature-ga…
Centril Dec 22, 2018
70a3be6
Rollup merge of #57049 - cramertj:repr-packed, r=Centril
Centril Dec 22, 2018
3e7957d
Rollup merge of #57050 - RyanMarcus:master, r=zackmdavis
Centril Dec 22, 2018
0105a24
Rollup merge of #57052 - Centril:fix-eip-stable-version, r=varkor
Centril Dec 22, 2018
aefca41
Rollup merge of #57053 - nikic:fix-gep-align, r=nagisa
Centril Dec 22, 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
7 changes: 4 additions & 3 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dependencies = [
"compiler_builtins 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"core 0.0.0",
"rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_xorshift 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
Expand Down Expand Up @@ -1334,7 +1335,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 +2687,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 +3503,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
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
15 changes: 15 additions & 0 deletions src/doc/rustdoc/src/unstable-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -402,3 +402,18 @@ Using `index-page` option enables `enable-index-page` option as well.
### `--enable-index-page`: generate a default index page for docs

This feature allows the generation of a default index-page which lists the generated crates.

### `--static-root-path`: control how static files are loaded in HTML output

Using this flag looks like this:

```bash
$ rustdoc src/lib.rs -Z unstable-options --static-root-path '/cache/'
```

This flag controls how rustdoc links to its static files on HTML pages. If you're hosting a lot of
crates' docs generated by the same version of rustdoc, you can use this flag to cache rustdoc's CSS,
JavaScript, and font files in a single location, rather than duplicating it once per "doc root"
(grouping of crate docs generated into the same output directory, like with `cargo doc`). Per-crate
files like the search index will still load from the documentation root, but anything that gets
renamed with `--resource-suffix` will load from the given path.
8 changes: 0 additions & 8 deletions src/doc/unstable-book/src/language-features/repr-packed.md

This file was deleted.

1 change: 1 addition & 0 deletions src/liballoc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ compiler_builtins = { version = "0.1.0", features = ['rustc-dep-of-std'] }

[dev-dependencies]
rand = "0.6"
rand_xorshift = "0.1"

[[test]]
name = "collectionstests"
Expand Down
4 changes: 2 additions & 2 deletions src/liballoc/benches/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use std::iter::Iterator;
use std::vec::Vec;
use std::collections::BTreeMap;
use rand::{Rng, thread_rng};
use rand::{Rng, seq::SliceRandom, thread_rng};
use test::{Bencher, black_box};

macro_rules! map_insert_rand_bench {
Expand Down Expand Up @@ -78,7 +78,7 @@ macro_rules! map_find_rand_bench {
map.insert(k, k);
}

rng.shuffle(&mut keys);
keys.shuffle(&mut rng);

// measure
let mut i = 0;
Expand Down
1 change: 1 addition & 0 deletions src/liballoc/benches/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#![feature(test)]

extern crate rand;
extern crate rand_xorshift;
extern crate test;

mod btree;
Expand Down
3 changes: 2 additions & 1 deletion src/liballoc/benches/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ use rand::{thread_rng};
use std::mem;
use std::ptr;

use rand::{Rng, SeedableRng, XorShiftRng};
use rand::{Rng, SeedableRng};
use rand::distributions::{Standard, Alphanumeric};
use rand_xorshift::XorShiftRng;
use test::{Bencher, black_box};

#[bench]
Expand Down
8 changes: 4 additions & 4 deletions src/liballoc/benches/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,11 @@ make_test!(split_a_str, s, s.split("a").count());
make_test!(trim_ascii_char, s, {
s.trim_matches(|c: char| c.is_ascii())
});
make_test!(trim_left_ascii_char, s, {
s.trim_left_matches(|c: char| c.is_ascii())
make_test!(trim_start_ascii_char, s, {
s.trim_start_matches(|c: char| c.is_ascii())
});
make_test!(trim_right_ascii_char, s, {
s.trim_right_matches(|c: char| c.is_ascii())
make_test!(trim_end_ascii_char, s, {
s.trim_end_matches(|c: char| c.is_ascii())
});

make_test!(find_underscore_char, s, s.find('_'));
Expand Down
10 changes: 6 additions & 4 deletions src/liballoc/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,11 @@ impl<T> Box<T> {
box x
}

#[unstable(feature = "pin", issue = "49150")]
/// Constructs a new `Pin<Box<T>>`. If `T` does not implement `Unpin`, then
/// `x` will be pinned in memory and unable to be moved.
#[stable(feature = "pin", since = "1.33.0")]
#[inline(always)]
pub fn pinned(x: T) -> Pin<Box<T>> {
pub fn pin(x: T) -> Pin<Box<T>> {
(box x).into()
}
}
Expand Down Expand Up @@ -444,7 +446,7 @@ impl<T> From<T> for Box<T> {
}
}

#[unstable(feature = "pin", issue = "49150")]
#[stable(feature = "pin", since = "1.33.0")]
impl<T> From<Box<T>> for Pin<Box<T>> {
fn from(boxed: Box<T>) -> Self {
// It's not possible to move or replace the insides of a `Pin<Box<T>>`
Expand Down Expand Up @@ -808,7 +810,7 @@ impl<T: ?Sized> AsMut<T> for Box<T> {
* implementation of `Unpin` (where `T: Unpin`) would be valid/safe, and
* could have a method to project a Pin<T> from it.
*/
#[unstable(feature = "pin", issue = "49150")]
#[stable(feature = "pin", since = "1.33.0")]
impl<T: ?Sized> Unpin for Box<T> { }

#[unstable(feature = "generator_trait", issue = "43122")]
Expand Down
116 changes: 113 additions & 3 deletions src/liballoc/collections/vec_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1897,8 +1897,6 @@ impl<T> VecDeque<T> {
/// # Examples
///
/// ```
/// #![feature(vec_resize_with)]
///
/// use std::collections::VecDeque;
///
/// let mut buf = VecDeque::new();
Expand All @@ -1917,7 +1915,7 @@ impl<T> VecDeque<T> {
/// buf.resize_with(5, || { state += 1; state });
/// assert_eq!(buf, [5, 10, 101, 102, 103]);
/// ```
#[unstable(feature = "vec_resize_with", issue = "41758")]
#[stable(feature = "vec_resize_with", since = "1.33.0")]
pub fn resize_with(&mut self, new_len: usize, generator: impl FnMut()->T) {
let len = self.len();

Expand All @@ -1927,6 +1925,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/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
test(no_crate_inject, attr(allow(unused_variables), deny(warnings))))]
#![no_std]
#![needs_allocator]

#![deny(intra_doc_link_resolution_failure)]
#![deny(missing_debug_implementations)]

#![cfg_attr(not(test), feature(fn_traits))]
Expand Down Expand Up @@ -100,7 +102,6 @@
#![feature(nll)]
#![feature(optin_builtin_traits)]
#![feature(pattern)]
#![feature(pin)]
#![feature(ptr_internals)]
#![feature(ptr_offset_from)]
#![feature(rustc_attrs)]
Expand Down
Loading