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 25 pull requests #57063

Merged
merged 61 commits into from
Dec 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
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
5056669
Fix rustdoc-js tests
JohnHeitmann Dec 18, 2018
50eb5f6
Explain the math
oli-obk 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
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
90726e1
suggest similar lint names for unknown lints
euclio 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
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
edd08e0
Optimize away a move
Zoxc Dec 6, 2018
4f30a24
Inline tweaks
Zoxc Dec 5, 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
22b2bd8
Update migrate warning wording.
davidtwco Dec 21, 2018
2d6927e
Rollup merge of #56802 - clarcharr:nth_back, r=alexcrichton
kennytm Dec 22, 2018
a92e21c
Rollup merge of #56909 - dlrobertson:fix_56762, r=estebank
kennytm Dec 22, 2018
beaf071
Rollup merge of #56914 - glaubitz:ignore-tests, r=alexcrichton
kennytm Dec 22, 2018
54d4e26
Rollup merge of #56919 - oli-obk:null_ref_array_tuple, r=RalfJung
kennytm Dec 22, 2018
660eca6
Rollup merge of #56933 - clarcharr:xpy_progress, r=Mark-Simulacrum
kennytm Dec 22, 2018
314e61f
Rollup merge of #56936 - ubsan:euclidean_div_rem, r=dtolnay
kennytm Dec 22, 2018
14ebca5
Rollup merge of #56941 - euclio:deny-libstd-resolution-failures, r=Qu…
kennytm Dec 22, 2018
1c76a2f
Rollup merge of #56967 - GuillaumeGomez:regen-search-index, r=QuietMi…
kennytm Dec 22, 2018
22dfa2b
Rollup merge of #56970 - Firstyear:mem_uninit_doc_ptr_drop, r=Manishe…
kennytm Dec 22, 2018
de2ba78
Rollup merge of #56973 - RalfJung:miri-trace, r=oli-obk
kennytm Dec 22, 2018
10d949a
Rollup merge of #56979 - VardhanThigle:Vardhan/rust-sgx-unwind-suppor…
kennytm Dec 22, 2018
40dc787
Rollup merge of #56981 - RalfJung:miri-infallible-alloc, r=oli-obk
kennytm Dec 22, 2018
afe572b
Rollup merge of #56984 - ljedrz:dropck_outlives_tweaks, r=oli-obk
kennytm Dec 22, 2018
10e4330
Rollup merge of #56989 - phansch:fix_compiletest_trim_deprecations, r…
kennytm Dec 22, 2018
7bb40eb
Rollup merge of #56992 - euclio:unknown-lint-suggestion, r=oli-obk
kennytm Dec 22, 2018
5ba6a34
Rollup merge of #57002 - scottmcm:stabilize-resize_with, r=rkruppe
kennytm Dec 22, 2018
4446c65
Rollup merge of #57011 - QuietMisdreavus:static-root-path, r=Guillaum…
kennytm Dec 22, 2018
9b2331d
Rollup merge of #57027 - Zoxc:query-perf5, r=michaelwoerister
kennytm Dec 22, 2018
5e727a4
Rollup merge of #57034 - Zoxc:query-perf8, r=michaelwoerister
kennytm Dec 22, 2018
e4430e0
Rollup merge of #57040 - otavio:topic/adjust-path_from_str-feature-ga…
kennytm Dec 22, 2018
60b4ea0
Rollup merge of #57049 - cramertj:repr-packed, r=Centril
kennytm Dec 22, 2018
bba398e
Rollup merge of #57050 - RyanMarcus:master, r=zackmdavis
kennytm Dec 22, 2018
5ffd1a6
Rollup merge of #57052 - Centril:fix-eip-stable-version, r=varkor
kennytm Dec 22, 2018
26842ae
Rollup merge of #57039 - davidtwco:migrate-warning-wording, r=pnkfelix
kennytm Dec 22, 2018
628c6d8
Rollup merge of #56945 - JohnHeitmann:rustdoc-js-tester-fix, r=Guilla…
kennytm 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
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
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.

4 changes: 1 addition & 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 Down
2 changes: 2 additions & 0 deletions 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
5 changes: 4 additions & 1 deletion src/liballoc/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,8 @@ unsafe impl<#[may_dangle] T: ?Sized> Drop for Rc<T> {
/// drop(foo); // Doesn't print anything
/// drop(foo2); // Prints "dropped!"
/// ```
///
/// [`Weak`]: ../../std/rc/struct.Weak.html
fn drop(&mut self) {
unsafe {
self.dec_strong();
Expand Down Expand Up @@ -1422,9 +1424,10 @@ impl<T: ?Sized + fmt::Debug> fmt::Debug for Weak<T> {
#[stable(feature = "downgraded_weak", since = "1.10.0")]
impl<T> Default for Weak<T> {
/// Constructs a new `Weak<T>`, allocating memory for `T` without initializing
/// it. Calling [`upgrade`][Weak::upgrade] on the return value always gives [`None`].
/// it. Calling [`upgrade`] on the return value always gives [`None`].
///
/// [`None`]: ../../std/option/enum.Option.html
/// [`upgrade`]: ../../std/rc/struct.Weak.html#method.upgrade
///
/// # Examples
///
Expand Down
5 changes: 4 additions & 1 deletion src/liballoc/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,8 @@ unsafe impl<#[may_dangle] T: ?Sized> Drop for Arc<T> {
/// drop(foo); // Doesn't print anything
/// drop(foo2); // Prints "dropped!"
/// ```
///
/// [`Weak`]: ../../std/sync/struct.Weak.html
#[inline]
fn drop(&mut self) {
// Because `fetch_sub` is already atomic, we do not need to synchronize
Expand Down Expand Up @@ -1222,10 +1224,11 @@ impl<T: ?Sized> Clone for Weak<T> {
#[stable(feature = "downgraded_weak", since = "1.10.0")]
impl<T> Default for Weak<T> {
/// Constructs a new `Weak<T>`, without allocating memory.
/// Calling [`upgrade`][Weak::upgrade] on the return value always
/// Calling [`upgrade`] on the return value always
/// gives [`None`].
///
/// [`None`]: ../../std/option/enum.Option.html#variant.None
/// [`upgrade`]: ../../std/sync/struct.Weak.html#method.upgrade
///
/// # Examples
///
Expand Down
4 changes: 1 addition & 3 deletions src/liballoc/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1241,8 +1241,6 @@ impl<T> Vec<T> {
/// # Examples
///
/// ```
/// #![feature(vec_resize_with)]
///
/// let mut vec = vec![1, 2, 3];
/// vec.resize_with(5, Default::default);
/// assert_eq!(vec, [1, 2, 3, 0, 0]);
Expand All @@ -1255,7 +1253,7 @@ impl<T> Vec<T> {
///
/// [`resize`]: #method.resize
/// [`Clone`]: ../../std/clone/trait.Clone.html
#[unstable(feature = "vec_resize_with", issue = "41758")]
#[stable(feature = "vec_resize_with", since = "1.33.0")]
pub fn resize_with<F>(&mut self, new_len: usize, f: F)
where F: FnMut() -> T
{
Expand Down
6 changes: 6 additions & 0 deletions src/libcore/iter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,9 @@ impl<I> Iterator for Rev<I> where I: DoubleEndedIterator {
#[inline]
fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }

#[inline]
fn nth(&mut self, n: usize) -> Option<<I as Iterator>::Item> { self.iter.nth_back(n) }

fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R where
Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try<Ok=B>
{
Expand Down Expand Up @@ -461,6 +464,9 @@ impl<I> DoubleEndedIterator for Rev<I> where I: DoubleEndedIterator {
#[inline]
fn next_back(&mut self) -> Option<<I as Iterator>::Item> { self.iter.next() }

#[inline]
fn nth_back(&mut self, n: usize) -> Option<<I as Iterator>::Item> { self.iter.nth(n) }

fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R where
Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try<Ok=B>
{
Expand Down
79 changes: 73 additions & 6 deletions src/libcore/iter/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,62 @@ pub trait DoubleEndedIterator: Iterator {
#[stable(feature = "rust1", since = "1.0.0")]
fn next_back(&mut self) -> Option<Self::Item>;

/// Returns the `n`th element from the end of the iterator.
///
/// This is essentially the reversed version of [`nth`]. Although like most indexing
/// operations, the count starts from zero, so `nth_back(0)` returns the first value fro
/// the end, `nth_back(1)` the second, and so on.
///
/// Note that all elements between the end and the returned element will be
/// consumed, including the returned element. This also means that calling
/// `nth_back(0)` multiple times on the same iterator will return different
/// elements.
///
/// `nth_back()` will return [`None`] if `n` is greater than or equal to the length of the
/// iterator.
///
/// [`None`]: ../../std/option/enum.Option.html#variant.None
/// [`nth`]: ../../std/iter/trait.Iterator.html#method.nth
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// #![feature(iter_nth_back)]
/// let a = [1, 2, 3];
/// assert_eq!(a.iter().nth_back(2), Some(&1));
/// ```
///
/// Calling `nth_back()` multiple times doesn't rewind the iterator:
///
/// ```
/// #![feature(iter_nth_back)]
/// let a = [1, 2, 3];
///
/// let mut iter = a.iter();
///
/// assert_eq!(iter.nth_back(1), Some(&2));
/// assert_eq!(iter.nth_back(1), None);
/// ```
///
/// Returning `None` if there are less than `n + 1` elements:
///
/// ```
/// #![feature(iter_nth_back)]
/// let a = [1, 2, 3];
/// assert_eq!(a.iter().nth_back(10), None);
/// ```
#[inline]
#[unstable(feature = "iter_nth_back", issue = "56995")]
fn nth_back(&mut self, mut n: usize) -> Option<Self::Item> {
for x in self.rev() {
if n == 0 { return Some(x) }
n -= 1;
}
None
}

/// This is the reverse version of [`try_fold()`]: it takes elements
/// starting from the back of the iterator.
///
Expand Down Expand Up @@ -461,8 +517,11 @@ pub trait DoubleEndedIterator: Iterator {
/// ```
#[inline]
#[stable(feature = "iterator_try_fold", since = "1.27.0")]
fn try_rfold<B, F, R>(&mut self, init: B, mut f: F) -> R where
Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try<Ok=B>
fn try_rfold<B, F, R>(&mut self, init: B, mut f: F) -> R
where
Self: Sized,
F: FnMut(B, Self::Item) -> R,
R: Try<Ok=B>
{
let mut accum = init;
while let Some(x) = self.next_back() {
Expand Down Expand Up @@ -524,8 +583,10 @@ pub trait DoubleEndedIterator: Iterator {
/// ```
#[inline]
#[stable(feature = "iter_rfold", since = "1.27.0")]
fn rfold<B, F>(mut self, accum: B, mut f: F) -> B where
Self: Sized, F: FnMut(B, Self::Item) -> B,
fn rfold<B, F>(mut self, accum: B, mut f: F) -> B
where
Self: Sized,
F: FnMut(B, Self::Item) -> B,
{
self.try_rfold(accum, move |acc, x| Ok::<B, !>(f(acc, x))).unwrap()
}
Expand Down Expand Up @@ -574,7 +635,8 @@ pub trait DoubleEndedIterator: Iterator {
/// ```
#[inline]
#[stable(feature = "iter_rfind", since = "1.27.0")]
fn rfind<P>(&mut self, mut predicate: P) -> Option<Self::Item> where
fn rfind<P>(&mut self, mut predicate: P) -> Option<Self::Item>
where
Self: Sized,
P: FnMut(&Self::Item) -> bool
{
Expand All @@ -587,7 +649,12 @@ pub trait DoubleEndedIterator: Iterator {

#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, I: DoubleEndedIterator + ?Sized> DoubleEndedIterator for &'a mut I {
fn next_back(&mut self) -> Option<I::Item> { (**self).next_back() }
fn next_back(&mut self) -> Option<I::Item> {
(**self).next_back()
}
fn nth_back(&mut self, n: usize) -> Option<I::Item> {
(**self).nth_back(n)
}
}

/// An iterator that knows its exact length.
Expand Down
1 change: 1 addition & 0 deletions src/libcore/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@

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

#![feature(allow_internal_unstable)]
Expand Down
42 changes: 42 additions & 0 deletions src/libcore/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,12 @@ pub unsafe fn zeroed<T>() -> T {
/// it goes out of scope (and therefore would be dropped). Note that this
/// includes a `panic` occurring and unwinding the stack suddenly.
///
/// If you partially initialize an array, you may need to use
/// [`ptr::drop_in_place`][drop_in_place] to remove the elements you have fully
/// initialized followed by [`mem::forget`][mem_forget] to prevent drop running
/// on the array. If a partially allocated array is dropped this will lead to
/// undefined behaviour.
///
/// # Examples
///
/// Here's how to safely initialize an array of [`Vec`]s.
Expand Down Expand Up @@ -583,11 +589,44 @@ pub unsafe fn zeroed<T>() -> T {
/// println!("{:?}", &data[0]);
/// ```
///
/// This example shows how to handle partially initialized arrays, which could
/// be found in low-level datastructures.
///
/// ```
/// use std::mem;
/// use std::ptr;
///
/// // Count the number of elements we have assigned.
/// let mut data_len: usize = 0;
/// let mut data: [String; 1000];
///
/// unsafe {
/// data = mem::uninitialized();
///
/// for elem in &mut data[0..500] {
/// ptr::write(elem, String::from("hello"));
/// data_len += 1;
/// }
///
/// // For each item in the array, drop if we allocated it.
/// for i in &mut data[0..data_len] {
/// ptr::drop_in_place(i);
/// }
/// }
/// // Forget the data. If this is allowed to drop, you may see a crash such as:
/// // 'mem_uninit_test(2457,0x7fffb55dd380) malloc: *** error for object
/// // 0x7ff3b8402920: pointer being freed was not allocated'
/// mem::forget(data);
/// ```
///
/// [`Vec`]: ../../std/vec/struct.Vec.html
/// [`vec!`]: ../../std/macro.vec.html
/// [`Clone`]: ../../std/clone/trait.Clone.html
/// [ub]: ../../reference/behavior-considered-undefined.html
/// [write]: ../ptr/fn.write.html
/// [drop_in_place]: ../ptr/fn.drop_in_place.html
/// [mem_zeroed]: fn.zeroed.html
/// [mem_forget]: fn.forget.html
/// [copy]: ../intrinsics/fn.copy.html
/// [copy_no]: ../intrinsics/fn.copy_nonoverlapping.html
/// [`Drop`]: ../ops/trait.Drop.html
Expand Down Expand Up @@ -984,6 +1023,9 @@ impl<T> ManuallyDrop<T> {
///
/// This function semantically moves out the contained value without preventing further usage.
/// It is up to the user of this method to ensure that this container is not used again.
///
/// [`ManuallyDrop::drop`]: #method.drop
/// [`ManuallyDrop::into_inner`]: #method.into_inner
#[must_use = "if you don't need the value, you can use `ManuallyDrop::drop` instead"]
#[unstable(feature = "manually_drop_take", issue = "55422")]
#[inline]
Expand Down
Loading