Skip to content

Commit 1a8b4e9

Browse files
committed
Auto merge of #56437 - Centril:rollup, r=Centril
Rollup of 14 pull requests Successful merges: - #56110 (Consider references and unions potentially inhabited during privacy-respecting inhabitedness checks) - #56305 (update miri) - #56366 (Stabilize self_in_typedefs feature) - #56372 (Refer to the second borrow as the "second borrow" in E0501.rs) - #56394 (Deal with EINTR in net timeout tests) - #56395 (Stabilize dbg!(...)) - #56401 (Move VecDeque::resize_with out of the impl<T:Clone> block) - #56402 (Improve the unstable book example for #[marker] trait) - #56412 (Update tracking issue for `extern_crate_self`) - #56416 (Remove unneeded body class selector) - #56418 (Fix failing tidy (line endings on Windows)) - #56419 (Remove some uses of try!) - #56424 (Mention raw-ident syntax) - #56432 (Update issue number of `shrink_to` methods to point the tracking issue) Failed merges: r? @ghost
2 parents 8660eba + c03c34c commit 1a8b4e9

File tree

66 files changed

+291
-290
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+291
-290
lines changed

Cargo.lock

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,15 @@ name = "difference"
624624
version = "2.0.0"
625625
source = "registry+https://github.com/rust-lang/crates.io-index"
626626

627+
[[package]]
628+
name = "directories"
629+
version = "1.0.2"
630+
source = "registry+https://github.com/rust-lang/crates.io-index"
631+
dependencies = [
632+
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
633+
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
634+
]
635+
627636
[[package]]
628637
name = "dlmalloc"
629638
version = "0.0.0"
@@ -1316,6 +1325,7 @@ dependencies = [
13161325
"cargo_metadata 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
13171326
"colored 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
13181327
"compiletest_rs 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)",
1328+
"directories 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
13191329
"env_logger 0.5.12 (registry+https://github.com/rust-lang/crates.io-index)",
13201330
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
13211331
"vergen 3.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3288,6 +3298,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
32883298
"checksum derive_more 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3f57d78cf3bd45270dad4e70c21ec77a960b36c7a841ff9db76aaa775a8fb871"
32893299
"checksum diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3c2b69f912779fbb121ceb775d74d51e915af17aaebc38d28a592843a2dd0a3a"
32903300
"checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198"
3301+
"checksum directories 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "72d337a64190607d4fcca2cb78982c5dd57f4916e19696b48a575fa746b6cb0f"
32913302
"checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0"
32923303
"checksum elasticlunr-rs 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4837d77a1e157489a3933b743fd774ae75074e0e390b2b7f071530048a0d87ee"
32933304
"checksum ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f56c93cc076508c549d9bb747f79aa9b4eb098be7b8cad8830c3137ef52d1e00"

src/bootstrap/doc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -915,13 +915,13 @@ fn symlink_dir_force(config: &Config, src: &Path, dst: &Path) -> io::Result<()>
915915
}
916916
if let Ok(m) = fs::symlink_metadata(dst) {
917917
if m.file_type().is_dir() {
918-
try!(fs::remove_dir_all(dst));
918+
fs::remove_dir_all(dst)?;
919919
} else {
920920
// handle directory junctions on windows by falling back to
921921
// `remove_dir`.
922-
try!(fs::remove_file(dst).or_else(|_| {
922+
fs::remove_file(dst).or_else(|_| {
923923
fs::remove_dir(dst)
924-
}));
924+
})?;
925925
}
926926
}
927927

src/bootstrap/util.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,11 @@ pub fn symlink_dir(config: &Config, src: &Path, dest: &Path) -> io::Result<()> {
203203
// We're using low-level APIs to create the junction, and these are more
204204
// picky about paths. For example, forward slashes cannot be used as a
205205
// path separator, so we should try to canonicalize the path first.
206-
let target = try!(fs::canonicalize(target));
206+
let target = fs::canonicalize(target)?;
207207

208-
try!(fs::create_dir(junction));
208+
fs::create_dir(junction)?;
209209

210-
let path = try!(to_u16s(junction));
210+
let path = to_u16s(junction)?;
211211

212212
unsafe {
213213
let h = CreateFileW(path.as_ptr(),

src/doc/edition-guide

src/doc/rustc-guide

src/doc/unstable-book/src/language-features/marker-trait-attr.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,17 @@ when they'd need to do the same thing for every type anyway).
1717
```rust
1818
#![feature(marker_trait_attr)]
1919

20-
use std::fmt::{Debug, Display};
20+
#[marker] trait CheapToClone: Clone {}
2121

22-
#[marker] trait MyMarker {}
22+
impl<T: Copy> CheapToClone for T {}
2323

24-
impl<T: Debug> MyMarker for T {}
25-
impl<T: Display> MyMarker for T {}
24+
// These could potentally overlap with the blanket implementation above,
25+
// so are only allowed because CheapToClone is a marker trait.
26+
impl<T: CheapToClone, U: CheapToClone> CheapToClone for (T, U) {}
27+
impl<T: CheapToClone> CheapToClone for std::ops::Range<T> {}
2628

27-
fn foo<T: MyMarker>(t: T) -> T {
28-
t
29+
fn cheap_clone<T: CheapToClone>(t: T) -> T {
30+
t.clone()
2931
}
3032
```
3133

src/doc/unstable-book/src/language-features/self-in-typedefs.md

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/liballoc/collections/binary_heap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ impl<T: Ord> BinaryHeap<T> {
529529
/// assert!(heap.capacity() >= 10);
530530
/// ```
531531
#[inline]
532-
#[unstable(feature = "shrink_to", reason = "new API", issue="0")]
532+
#[unstable(feature = "shrink_to", reason = "new API", issue="56431")]
533533
pub fn shrink_to(&mut self, min_capacity: usize) {
534534
self.data.shrink_to(min_capacity)
535535
}

src/liballoc/collections/vec_deque.rs

Lines changed: 28 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
use core::cmp::Ordering;
2121
use core::fmt;
22-
use core::iter::{repeat, repeat_with, FromIterator, FusedIterator};
22+
use core::iter::{repeat_with, FromIterator, FusedIterator};
2323
use core::mem;
2424
use core::ops::Bound::{Excluded, Included, Unbounded};
2525
use core::ops::{Index, IndexMut, RangeBounds};
@@ -701,7 +701,7 @@ impl<T> VecDeque<T> {
701701
/// buf.shrink_to(0);
702702
/// assert!(buf.capacity() >= 4);
703703
/// ```
704-
#[unstable(feature = "shrink_to", reason = "new API", issue="0")]
704+
#[unstable(feature = "shrink_to", reason = "new API", issue="56431")]
705705
pub fn shrink_to(&mut self, min_capacity: usize) {
706706
assert!(self.capacity() >= min_capacity, "Tried to shrink to a larger capacity");
707707

@@ -1886,16 +1886,16 @@ impl<T> VecDeque<T> {
18861886
debug_assert!(!self.is_full());
18871887
}
18881888
}
1889-
}
18901889

1891-
impl<T: Clone> VecDeque<T> {
1892-
/// Modifies the `VecDeque` in-place so that `len()` is equal to new_len,
1893-
/// either by removing excess elements from the back or by appending clones of `value`
1894-
/// to the back.
1890+
/// Modifies the `VecDeque` in-place so that `len()` is equal to `new_len`,
1891+
/// either by removing excess elements from the back or by appending
1892+
/// elements generated by calling `generator` to the back.
18951893
///
18961894
/// # Examples
18971895
///
18981896
/// ```
1897+
/// #![feature(vec_resize_with)]
1898+
///
18991899
/// use std::collections::VecDeque;
19001900
///
19011901
/// let mut buf = VecDeque::new();
@@ -1904,32 +1904,36 @@ impl<T: Clone> VecDeque<T> {
19041904
/// buf.push_back(15);
19051905
/// assert_eq!(buf, [5, 10, 15]);
19061906
///
1907-
/// buf.resize(2, 0);
1907+
/// buf.resize_with(5, Default::default);
1908+
/// assert_eq!(buf, [5, 10, 15, 0, 0]);
1909+
///
1910+
/// buf.resize_with(2, || unreachable!());
19081911
/// assert_eq!(buf, [5, 10]);
19091912
///
1910-
/// buf.resize(5, 20);
1911-
/// assert_eq!(buf, [5, 10, 20, 20, 20]);
1913+
/// let mut state = 100;
1914+
/// buf.resize_with(5, || { state += 1; state });
1915+
/// assert_eq!(buf, [5, 10, 101, 102, 103]);
19121916
/// ```
1913-
#[stable(feature = "deque_extras", since = "1.16.0")]
1914-
pub fn resize(&mut self, new_len: usize, value: T) {
1917+
#[unstable(feature = "vec_resize_with", issue = "41758")]
1918+
pub fn resize_with(&mut self, new_len: usize, generator: impl FnMut()->T) {
19151919
let len = self.len();
19161920

19171921
if new_len > len {
1918-
self.extend(repeat(value).take(new_len - len))
1922+
self.extend(repeat_with(generator).take(new_len - len))
19191923
} else {
19201924
self.truncate(new_len);
19211925
}
19221926
}
1927+
}
19231928

1924-
/// Modifies the `VecDeque` in-place so that `len()` is equal to `new_len`,
1925-
/// either by removing excess elements from the back or by appending
1926-
/// elements generated by calling `generator` to the back.
1929+
impl<T: Clone> VecDeque<T> {
1930+
/// Modifies the `VecDeque` in-place so that `len()` is equal to new_len,
1931+
/// either by removing excess elements from the back or by appending clones of `value`
1932+
/// to the back.
19271933
///
19281934
/// # Examples
19291935
///
19301936
/// ```
1931-
/// #![feature(vec_resize_with)]
1932-
///
19331937
/// use std::collections::VecDeque;
19341938
///
19351939
/// let mut buf = VecDeque::new();
@@ -1938,25 +1942,15 @@ impl<T: Clone> VecDeque<T> {
19381942
/// buf.push_back(15);
19391943
/// assert_eq!(buf, [5, 10, 15]);
19401944
///
1941-
/// buf.resize_with(5, Default::default);
1942-
/// assert_eq!(buf, [5, 10, 15, 0, 0]);
1943-
///
1944-
/// buf.resize_with(2, || unreachable!());
1945+
/// buf.resize(2, 0);
19451946
/// assert_eq!(buf, [5, 10]);
19461947
///
1947-
/// let mut state = 100;
1948-
/// buf.resize_with(5, || { state += 1; state });
1949-
/// assert_eq!(buf, [5, 10, 101, 102, 103]);
1948+
/// buf.resize(5, 20);
1949+
/// assert_eq!(buf, [5, 10, 20, 20, 20]);
19501950
/// ```
1951-
#[unstable(feature = "vec_resize_with", issue = "41758")]
1952-
pub fn resize_with(&mut self, new_len: usize, generator: impl FnMut()->T) {
1953-
let len = self.len();
1954-
1955-
if new_len > len {
1956-
self.extend(repeat_with(generator).take(new_len - len))
1957-
} else {
1958-
self.truncate(new_len);
1959-
}
1951+
#[stable(feature = "deque_extras", since = "1.16.0")]
1952+
pub fn resize(&mut self, new_len: usize, value: T) {
1953+
self.resize_with(new_len, || value.clone());
19601954
}
19611955
}
19621956

src/liballoc/string.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,7 @@ impl String {
10501050
/// assert!(s.capacity() >= 3);
10511051
/// ```
10521052
#[inline]
1053-
#[unstable(feature = "shrink_to", reason = "new API", issue="0")]
1053+
#[unstable(feature = "shrink_to", reason = "new API", issue="56431")]
10541054
pub fn shrink_to(&mut self, min_capacity: usize) {
10551055
self.vec.shrink_to(min_capacity)
10561056
}

0 commit comments

Comments
 (0)