Skip to content

Commit b107f72

Browse files
committed
Auto merge of #47151 - kennytm:rollup, r=kennytm
Rollup of 9 pull requests - Successful merges: #47104, #47107, #47113, #47117, #47118, #47121, #47125, #47134, #47145 - Failed merges:
2 parents b893439 + b416119 commit b107f72

File tree

12 files changed

+87
-39
lines changed

12 files changed

+87
-39
lines changed

src/doc/unstable-book/src/library-features/proc-macro.md

-7
This file was deleted.

src/liballoc/slice.rs

+14-6
Original file line numberDiff line numberDiff line change
@@ -606,14 +606,14 @@ impl<T> [T] {
606606
core_slice::SliceExt::windows(self, size)
607607
}
608608

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

634634
/// Returns an iterator over `chunk_size` elements of the slice at a time.
@@ -1725,6 +1725,14 @@ impl [u8] {
17251725
reason = "trait should not have to exist",
17261726
issue = "27747")]
17271727
/// An extension trait for concatenating slices
1728+
///
1729+
/// While this trait is unstable, the methods are stable. `SliceConcatExt` is
1730+
/// included in the [standard library prelude], so you can use [`join()`] and
1731+
/// [`concat()`] as if they existed on `[T]` itself.
1732+
///
1733+
/// [standard library prelude]: ../../std/prelude/index.html
1734+
/// [`join()`]: #tymethod.join
1735+
/// [`concat()`]: #tymethod.concat
17281736
pub trait SliceConcatExt<T: ?Sized> {
17291737
#[unstable(feature = "slice_concat_ext",
17301738
reason = "trait should not have to exist",

src/liballoc/vec.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ impl<T> Vec<T> {
715715
///
716716
/// # Panics
717717
///
718-
/// Panics if `index` is out of bounds.
718+
/// Panics if `index > len`.
719719
///
720720
/// # Examples
721721
///

src/libcore/slice/memchr.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ fn repeat_byte(b: u8) -> usize {
5656
rep
5757
}
5858

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

104-
/// Return the last index matching the byte `a` in `text`.
104+
/// Return the last index matching the byte `x` in `text`.
105105
pub fn memrchr(x: u8, text: &[u8]) -> Option<usize> {
106106
// Scan for a single byte value by reading two `usize` words at a time.
107107
//

src/libcore/slice/mod.rs

+16-16
Original file line numberDiff line numberDiff line change
@@ -348,9 +348,9 @@ impl<T> SliceExt for [T] {
348348
}
349349

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

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

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

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

2120-
/// An iterator over a slice in (non-overlapping) chunks (`size` elements at a
2120+
/// An iterator over a slice in (non-overlapping) chunks (`chunk_size` elements at a
21212121
/// time).
21222122
///
21232123
/// 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> {}
21312131
#[stable(feature = "rust1", since = "1.0.0")]
21322132
pub struct Chunks<'a, T:'a> {
21332133
v: &'a [T],
2134-
size: usize
2134+
chunk_size: usize
21352135
}
21362136

21372137
// FIXME(#26925) Remove in favor of `#[derive(Clone)]`
@@ -2140,7 +2140,7 @@ impl<'a, T> Clone for Chunks<'a, T> {
21402140
fn clone(&self) -> Chunks<'a, T> {
21412141
Chunks {
21422142
v: self.v,
2143-
size: self.size,
2143+
chunk_size: self.chunk_size,
21442144
}
21452145
}
21462146
}
@@ -2154,7 +2154,7 @@ impl<'a, T> Iterator for Chunks<'a, T> {
21542154
if self.v.is_empty() {
21552155
None
21562156
} else {
2157-
let chunksz = cmp::min(self.v.len(), self.size);
2157+
let chunksz = cmp::min(self.v.len(), self.chunk_size);
21582158
let (fst, snd) = self.v.split_at(chunksz);
21592159
self.v = snd;
21602160
Some(fst)
@@ -2166,8 +2166,8 @@ impl<'a, T> Iterator for Chunks<'a, T> {
21662166
if self.v.is_empty() {
21672167
(0, Some(0))
21682168
} else {
2169-
let n = self.v.len() / self.size;
2170-
let rem = self.v.len() % self.size;
2169+
let n = self.v.len() / self.chunk_size;
2170+
let rem = self.v.len() % self.chunk_size;
21712171
let n = if rem > 0 { n+1 } else { n };
21722172
(n, Some(n))
21732173
}
@@ -2180,12 +2180,12 @@ impl<'a, T> Iterator for Chunks<'a, T> {
21802180

21812181
#[inline]
21822182
fn nth(&mut self, n: usize) -> Option<Self::Item> {
2183-
let (start, overflow) = n.overflowing_mul(self.size);
2183+
let (start, overflow) = n.overflowing_mul(self.chunk_size);
21842184
if start >= self.v.len() || overflow {
21852185
self.v = &[];
21862186
None
21872187
} else {
2188-
let end = match start.checked_add(self.size) {
2188+
let end = match start.checked_add(self.chunk_size) {
21892189
Some(sum) => cmp::min(self.v.len(), sum),
21902190
None => self.v.len(),
21912191
};
@@ -2200,7 +2200,7 @@ impl<'a, T> Iterator for Chunks<'a, T> {
22002200
if self.v.is_empty() {
22012201
None
22022202
} else {
2203-
let start = (self.v.len() - 1) / self.size * self.size;
2203+
let start = (self.v.len() - 1) / self.chunk_size * self.chunk_size;
22042204
Some(&self.v[start..])
22052205
}
22062206
}
@@ -2213,8 +2213,8 @@ impl<'a, T> DoubleEndedIterator for Chunks<'a, T> {
22132213
if self.v.is_empty() {
22142214
None
22152215
} else {
2216-
let remainder = self.v.len() % self.size;
2217-
let chunksz = if remainder != 0 { remainder } else { self.size };
2216+
let remainder = self.v.len() % self.chunk_size;
2217+
let chunksz = if remainder != 0 { remainder } else { self.chunk_size };
22182218
let (fst, snd) = self.v.split_at(self.v.len() - chunksz);
22192219
self.v = fst;
22202220
Some(snd)
@@ -2228,7 +2228,7 @@ impl<'a, T> ExactSizeIterator for Chunks<'a, T> {}
22282228
#[unstable(feature = "fused", issue = "35602")]
22292229
impl<'a, T> FusedIterator for Chunks<'a, T> {}
22302230

2231-
/// An iterator over a slice in (non-overlapping) mutable chunks (`size`
2231+
/// An iterator over a slice in (non-overlapping) mutable chunks (`chunk_size`
22322232
/// elements at a time). When the slice len is not evenly divided by the chunk
22332233
/// size, the last slice of the iteration will be the remainder.
22342234
///

src/librustc/mir/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ ensure that, before the MIR at a particular phase in the processing
5959
pipeline is stolen, anyone who may want to read from it has already
6060
done so. Concretely, this means that if you have some query `foo(D)`
6161
that wants to access the result of `mir_const(D)` or
62-
`mir_validated(D)`, you need to have the successor pass either "force"
62+
`mir_validated(D)`, you need to have the successor pass "force"
6363
`foo(D)` using `ty::queries::foo::force(...)`. This will force a query
6464
to execute even though you don't directly require its result.
6565

src/librustc_typeck/check/dropck.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,13 @@ pub fn check_drop_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
5959
}
6060
_ => {
6161
// Destructors only work on nominal types. This was
62-
// already checked by coherence, so we can panic here.
62+
// already checked by coherence, but compilation may
63+
// not have been terminated.
6364
let span = tcx.def_span(drop_impl_did);
64-
span_bug!(span,
65-
"should have been rejected by coherence check: {}",
66-
dtor_self_type);
65+
tcx.sess.delay_span_bug(span,
66+
&format!("should have been rejected by coherence check: {}",
67+
dtor_self_type));
68+
Err(ErrorReported)
6769
}
6870
}
6971
}

src/librustdoc/html/static/main.js

+6
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@
258258
addClass(search, "hidden");
259259
removeClass(document.getElementById("main"), "hidden");
260260
}
261+
defocusSearchBar();
261262
break;
262263

263264
case "s":
@@ -1884,3 +1885,8 @@
18841885
function focusSearchBar() {
18851886
document.getElementsByClassName('search-input')[0].focus();
18861887
}
1888+
1889+
// Removes the focus from the search bar
1890+
function defocusSearchBar() {
1891+
document.getElementsByClassName('search-input')[0].blur();
1892+
}

src/libstd/io/buffered.rs

+11
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,10 @@ impl<W: Write> BufWriter<W> {
486486
///
487487
/// The buffer is written out before returning the writer.
488488
///
489+
/// # Errors
490+
///
491+
/// An `Err` will be returned if an error occurs while flushing the buffer.
492+
///
489493
/// # Examples
490494
///
491495
/// ```no_run
@@ -650,6 +654,9 @@ impl<W> fmt::Display for IntoInnerError<W> {
650654
/// completed, rather than the entire buffer at once. Enter `LineWriter`. It
651655
/// does exactly that.
652656
///
657+
/// Like [`BufWriter`], a `LineWriter`’s buffer will also be flushed when the
658+
/// `LineWriter` goes out of scope or when its internal buffer is full.
659+
///
653660
/// [bufwriter]: struct.BufWriter.html
654661
///
655662
/// If there's still a partial line in the buffer when the `LineWriter` is
@@ -785,6 +792,10 @@ impl<W: Write> LineWriter<W> {
785792
///
786793
/// The internal buffer is written out before returning the writer.
787794
///
795+
// # Errors
796+
///
797+
/// An `Err` will be returned if an error occurs while flushing the buffer.
798+
///
788799
/// # Examples
789800
///
790801
/// ```

src/test/compile-fail/issue-41974.rs

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#[derive(Copy, Clone)]
12+
struct Flags;
13+
14+
trait A {
15+
}
16+
17+
impl<T> Drop for T where T: A { //~ ERROR E0119
18+
//~^ ERROR E0120
19+
//~| ERROR E0210
20+
fn drop(&mut self) {
21+
}
22+
}
23+
24+
fn main() {}

src/tools/tidy/src/unstable_book.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ pub fn check(path: &path::Path, bad: &mut bool) {
8787
// Library features
8888

8989
let lang_features = collect_lang_features(path);
90-
let lib_features = collect_lib_features(path);
90+
let lib_features = collect_lib_features(path).into_iter().filter(|&(ref name, _)| {
91+
!lang_features.contains_key(name)
92+
}).collect();
9193

9294
let unstable_lib_feature_names = collect_unstable_feature_names(&lib_features);
9395
let unstable_book_lib_features_section_file_names =

src/tools/unstable-book-gen/src/main.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,9 @@ fn main() {
129129
let dest_path = Path::new(&dest_path_str).join("src");
130130

131131
let lang_features = collect_lang_features(src_path);
132-
let lib_features = collect_lib_features(src_path);
132+
let lib_features = collect_lib_features(src_path).into_iter().filter(|&(ref name, _)| {
133+
!lang_features.contains_key(name)
134+
}).collect();
133135

134136
let doc_src_path = src_path.join(PATH_STR);
135137

0 commit comments

Comments
 (0)