Skip to content

Rollup of 9 pull requests #47151

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

Merged
merged 21 commits into from
Jan 3, 2018
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
46cd410
remove duplicate stubs
tinaun Oct 13, 2017
d7cdd56
memchr: fix variable name in docstrings
hdhoang Jan 1, 2018
31a4cba
Delay panic from incoherent drop implementation
matthewjasper Jan 1, 2018
05cbe6d
Fix typo
mark-i-m Jan 1, 2018
5c25b0c
prevent generating duplicate stubs
tinaun Jan 2, 2018
301e457
Fix panic condition docs for Vec::insert.
frewsxcv Jan 2, 2018
9957cf6
Consistently use chunk_size as the field name for Chunks and ChunksMut
sdroege Jan 1, 2018
c096b3a
Use assert!(chunk_size != 0) instead of > 0 for usize value
sdroege Jan 1, 2018
d5acd23
Mention SliceConcatExt's stability in its docs
daboross Jan 2, 2018
0772b6f
Defocus search bar in rustdoc pages
Sogomn Jan 2, 2018
3153d23
Indentation fix
Sogomn Jan 2, 2018
f3ef077
Document when LineWriter flushes; document errors for into_inner.
frewsxcv Jan 2, 2018
f7932ef
Rollup merge of #47104 - matthewjasper:dont-panic-on-generic-drop, r=…
kennytm Jan 3, 2018
dd0b70e
Rollup merge of #47107 - mark-i-m:patch-1, r=steveklabnik
kennytm Jan 3, 2018
219e72c
Rollup merge of #47113 - sdroege:chunks-size-field, r=dtolnay
kennytm Jan 3, 2018
d6cf5a5
Rollup merge of #47117 - tinaun:no_more_dups, r=frewsxcv
kennytm Jan 3, 2018
2182f14
Rollup merge of #47118 - hdhoang:patch-2, r=BurntSushi
kennytm Jan 3, 2018
8bfb420
Rollup merge of #47121 - frewsxcv:frewsxcv-vec, r=kennytm
kennytm Jan 3, 2018
bf3fd17
Rollup merge of #47125 - daboross:patch-3, r=estebank
kennytm Jan 3, 2018
08501bd
Rollup merge of #47134 - Sogomn:master, r=QuietMisdreavus
kennytm Jan 3, 2018
b416119
Rollup merge of #47145 - frewsxcv:frewsxcv-linewriter-error, r=QuietM…
kennytm Jan 3, 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: 0 additions & 7 deletions src/doc/unstable-book/src/library-features/proc-macro.md

This file was deleted.

20 changes: 14 additions & 6 deletions src/liballoc/slice.rs
Original file line number Diff line number Diff line change
@@ -606,14 +606,14 @@ impl<T> [T] {
core_slice::SliceExt::windows(self, size)
}

/// Returns an iterator over `size` elements of the slice at a
/// time. The chunks are slices and do not overlap. If `size` does
/// Returns an iterator over `chunk_size` elements of the slice at a
/// time. The chunks are slices and do not overlap. If `chunk_size` does
/// not divide the length of the slice, then the last chunk will
/// not have length `size`.
/// not have length `chunk_size`.
///
/// # Panics
///
/// Panics if `size` is 0.
/// Panics if `chunk_size` is 0.
///
/// # Examples
///
@@ -627,8 +627,8 @@ impl<T> [T] {
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn chunks(&self, size: usize) -> Chunks<T> {
core_slice::SliceExt::chunks(self, size)
pub fn chunks(&self, chunk_size: usize) -> Chunks<T> {
core_slice::SliceExt::chunks(self, chunk_size)
}

/// Returns an iterator over `chunk_size` elements of the slice at a time.
@@ -1725,6 +1725,14 @@ impl [u8] {
reason = "trait should not have to exist",
issue = "27747")]
/// An extension trait for concatenating slices
///
/// While this trait is unstable, the methods are stable. `SliceConcatExt` is
/// included in the [standard library prelude], so you can use [`join()`] and
/// [`concat()`] as if they existed on `[T]` itself.
///
/// [standard library prelude]: ../../std/prelude/index.html
/// [`join()`]: #tymethod.join
/// [`concat()`]: #tymethod.concat
pub trait SliceConcatExt<T: ?Sized> {
#[unstable(feature = "slice_concat_ext",
reason = "trait should not have to exist",
2 changes: 1 addition & 1 deletion src/liballoc/vec.rs
Original file line number Diff line number Diff line change
@@ -715,7 +715,7 @@ impl<T> Vec<T> {
///
/// # Panics
///
/// Panics if `index` is out of bounds.
/// Panics if `index > len`.
///
/// # Examples
///
4 changes: 2 additions & 2 deletions src/libcore/slice/memchr.rs
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@ fn repeat_byte(b: u8) -> usize {
rep
}

/// Return the first index matching the byte `a` in `text`.
/// Return the first index matching the byte `x` in `text`.
pub fn memchr(x: u8, text: &[u8]) -> Option<usize> {
// Scan for a single byte value by reading two `usize` words at a time.
//
@@ -101,7 +101,7 @@ pub fn memchr(x: u8, text: &[u8]) -> Option<usize> {
text[offset..].iter().position(|elt| *elt == x).map(|i| offset + i)
}

/// Return the last index matching the byte `a` in `text`.
/// Return the last index matching the byte `x` in `text`.
pub fn memrchr(x: u8, text: &[u8]) -> Option<usize> {
// Scan for a single byte value by reading two `usize` words at a time.
//
32 changes: 16 additions & 16 deletions src/libcore/slice/mod.rs
Original file line number Diff line number Diff line change
@@ -348,9 +348,9 @@ impl<T> SliceExt for [T] {
}

#[inline]
fn chunks(&self, size: usize) -> Chunks<T> {
assert!(size != 0);
Chunks { v: self, size: size }
fn chunks(&self, chunk_size: usize) -> Chunks<T> {
assert!(chunk_size != 0);
Chunks { v: self, chunk_size: chunk_size }
}

#[inline]
@@ -532,7 +532,7 @@ impl<T> SliceExt for [T] {

#[inline]
fn chunks_mut(&mut self, chunk_size: usize) -> ChunksMut<T> {
assert!(chunk_size > 0);
assert!(chunk_size != 0);
ChunksMut { v: self, chunk_size: chunk_size }
}

@@ -2117,7 +2117,7 @@ impl<'a, T> ExactSizeIterator for Windows<'a, T> {}
#[unstable(feature = "fused", issue = "35602")]
impl<'a, T> FusedIterator for Windows<'a, T> {}

/// An iterator over a slice in (non-overlapping) chunks (`size` elements at a
/// An iterator over a slice in (non-overlapping) chunks (`chunk_size` elements at a
/// time).
///
/// When the slice len is not evenly divided by the chunk size, the last slice
@@ -2131,7 +2131,7 @@ impl<'a, T> FusedIterator for Windows<'a, T> {}
#[stable(feature = "rust1", since = "1.0.0")]
pub struct Chunks<'a, T:'a> {
v: &'a [T],
size: usize
chunk_size: usize
}

// FIXME(#26925) Remove in favor of `#[derive(Clone)]`
@@ -2140,7 +2140,7 @@ impl<'a, T> Clone for Chunks<'a, T> {
fn clone(&self) -> Chunks<'a, T> {
Chunks {
v: self.v,
size: self.size,
chunk_size: self.chunk_size,
}
}
}
@@ -2154,7 +2154,7 @@ impl<'a, T> Iterator for Chunks<'a, T> {
if self.v.is_empty() {
None
} else {
let chunksz = cmp::min(self.v.len(), self.size);
let chunksz = cmp::min(self.v.len(), self.chunk_size);
let (fst, snd) = self.v.split_at(chunksz);
self.v = snd;
Some(fst)
@@ -2166,8 +2166,8 @@ impl<'a, T> Iterator for Chunks<'a, T> {
if self.v.is_empty() {
(0, Some(0))
} else {
let n = self.v.len() / self.size;
let rem = self.v.len() % self.size;
let n = self.v.len() / self.chunk_size;
let rem = self.v.len() % self.chunk_size;
let n = if rem > 0 { n+1 } else { n };
(n, Some(n))
}
@@ -2180,12 +2180,12 @@ impl<'a, T> Iterator for Chunks<'a, T> {

#[inline]
fn nth(&mut self, n: usize) -> Option<Self::Item> {
let (start, overflow) = n.overflowing_mul(self.size);
let (start, overflow) = n.overflowing_mul(self.chunk_size);
if start >= self.v.len() || overflow {
self.v = &[];
None
} else {
let end = match start.checked_add(self.size) {
let end = match start.checked_add(self.chunk_size) {
Some(sum) => cmp::min(self.v.len(), sum),
None => self.v.len(),
};
@@ -2200,7 +2200,7 @@ impl<'a, T> Iterator for Chunks<'a, T> {
if self.v.is_empty() {
None
} else {
let start = (self.v.len() - 1) / self.size * self.size;
let start = (self.v.len() - 1) / self.chunk_size * self.chunk_size;
Some(&self.v[start..])
}
}
@@ -2213,8 +2213,8 @@ impl<'a, T> DoubleEndedIterator for Chunks<'a, T> {
if self.v.is_empty() {
None
} else {
let remainder = self.v.len() % self.size;
let chunksz = if remainder != 0 { remainder } else { self.size };
let remainder = self.v.len() % self.chunk_size;
let chunksz = if remainder != 0 { remainder } else { self.chunk_size };
let (fst, snd) = self.v.split_at(self.v.len() - chunksz);
self.v = fst;
Some(snd)
@@ -2228,7 +2228,7 @@ impl<'a, T> ExactSizeIterator for Chunks<'a, T> {}
#[unstable(feature = "fused", issue = "35602")]
impl<'a, T> FusedIterator for Chunks<'a, T> {}

/// An iterator over a slice in (non-overlapping) mutable chunks (`size`
/// An iterator over a slice in (non-overlapping) mutable chunks (`chunk_size`
/// elements at a time). When the slice len is not evenly divided by the chunk
/// size, the last slice of the iteration will be the remainder.
///
2 changes: 1 addition & 1 deletion src/librustc/mir/README.md
Original file line number Diff line number Diff line change
@@ -59,7 +59,7 @@ ensure that, before the MIR at a particular phase in the processing
pipeline is stolen, anyone who may want to read from it has already
done so. Concretely, this means that if you have some query `foo(D)`
that wants to access the result of `mir_const(D)` or
`mir_validated(D)`, you need to have the successor pass either "force"
`mir_validated(D)`, you need to have the successor pass "force"
`foo(D)` using `ty::queries::foo::force(...)`. This will force a query
to execute even though you don't directly require its result.

10 changes: 6 additions & 4 deletions src/librustc_typeck/check/dropck.rs
Original file line number Diff line number Diff line change
@@ -59,11 +59,13 @@ pub fn check_drop_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
}
_ => {
// Destructors only work on nominal types. This was
// already checked by coherence, so we can panic here.
// already checked by coherence, but compilation may
// not have been terminated.
let span = tcx.def_span(drop_impl_did);
span_bug!(span,
"should have been rejected by coherence check: {}",
dtor_self_type);
tcx.sess.delay_span_bug(span,
&format!("should have been rejected by coherence check: {}",
dtor_self_type));
Err(ErrorReported)
}
}
}
6 changes: 6 additions & 0 deletions src/librustdoc/html/static/main.js
Original file line number Diff line number Diff line change
@@ -258,6 +258,7 @@
addClass(search, "hidden");
removeClass(document.getElementById("main"), "hidden");
}
defocusSearchBar();
break;

case "s":
@@ -1884,3 +1885,8 @@
function focusSearchBar() {
document.getElementsByClassName('search-input')[0].focus();
}

// Removes the focus from the search bar
function defocusSearchBar() {
document.getElementsByClassName('search-input')[0].blur();
}
11 changes: 11 additions & 0 deletions src/libstd/io/buffered.rs
Original file line number Diff line number Diff line change
@@ -486,6 +486,10 @@ impl<W: Write> BufWriter<W> {
///
/// The buffer is written out before returning the writer.
///
/// # Errors
///
/// An `Err` will be returned if an error occurs while flushing the buffer.
///
/// # Examples
///
/// ```no_run
@@ -650,6 +654,9 @@ impl<W> fmt::Display for IntoInnerError<W> {
/// completed, rather than the entire buffer at once. Enter `LineWriter`. It
/// does exactly that.
///
/// Like [`BufWriter`], a `LineWriter`’s buffer will also be flushed when the
/// `LineWriter` goes out of scope or when its internal buffer is full.
///
/// [bufwriter]: struct.BufWriter.html
///
/// If there's still a partial line in the buffer when the `LineWriter` is
@@ -785,6 +792,10 @@ impl<W: Write> LineWriter<W> {
///
/// The internal buffer is written out before returning the writer.
///
// # Errors
///
/// An `Err` will be returned if an error occurs while flushing the buffer.
///
/// # Examples
///
/// ```
24 changes: 24 additions & 0 deletions src/test/compile-fail/issue-41974.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[derive(Copy, Clone)]
struct Flags;

trait A {
}

impl<T> Drop for T where T: A { //~ ERROR E0119
//~^ ERROR E0120
//~| ERROR E0210
fn drop(&mut self) {
}
}

fn main() {}
4 changes: 3 additions & 1 deletion src/tools/tidy/src/unstable_book.rs
Original file line number Diff line number Diff line change
@@ -87,7 +87,9 @@ pub fn check(path: &path::Path, bad: &mut bool) {
// Library features

let lang_features = collect_lang_features(path);
let lib_features = collect_lib_features(path);
let lib_features = collect_lib_features(path).into_iter().filter(|&(ref name, _)| {
!lang_features.contains_key(name)
}).collect();

let unstable_lib_feature_names = collect_unstable_feature_names(&lib_features);
let unstable_book_lib_features_section_file_names =
4 changes: 3 additions & 1 deletion src/tools/unstable-book-gen/src/main.rs
Original file line number Diff line number Diff line change
@@ -129,7 +129,9 @@ fn main() {
let dest_path = Path::new(&dest_path_str).join("src");

let lang_features = collect_lang_features(src_path);
let lib_features = collect_lib_features(src_path);
let lib_features = collect_lib_features(src_path).into_iter().filter(|&(ref name, _)| {
!lang_features.contains_key(name)
}).collect();

let doc_src_path = src_path.join(PATH_STR);