Skip to content

Commit 0c999ed

Browse files
committed
Auto merge of rust-lang#56451 - kennytm:rollup, r=kennytm
Rollup of 13 pull requests Successful merges: - rust-lang#56141 ([std] Osstr len clarity) - rust-lang#56366 (Stabilize self_in_typedefs feature) - rust-lang#56395 (Stabilize dbg!(...)) - rust-lang#56401 (Move VecDeque::resize_with out of the impl<T:Clone> block) - rust-lang#56402 (Improve the unstable book example for #[marker] trait) - rust-lang#56412 (Update tracking issue for `extern_crate_self`) - rust-lang#56416 (Remove unneeded body class selector) - rust-lang#56418 (Fix failing tidy (line endings on Windows)) - rust-lang#56419 (Remove some uses of try!) - rust-lang#56432 (Update issue number of `shrink_to` methods to point the tracking issue) - rust-lang#56433 (Add description about `crate` for parse_visibility's comment) - rust-lang#56435 (make the C part of compiler-builtins opt-out) - rust-lang#56438 (Remove not used `DotEq` token) Failed merges: r? @ghost
2 parents 9cd3bef + ac363d8 commit 0c999ed

Some content is hidden

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

50 files changed

+140
-224
lines changed

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
}

src/liballoc/vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ impl<T> Vec<T> {
613613
/// vec.shrink_to(0);
614614
/// assert!(vec.capacity() >= 3);
615615
/// ```
616-
#[unstable(feature = "shrink_to", reason = "new API", issue="0")]
616+
#[unstable(feature = "shrink_to", reason = "new API", issue="56431")]
617617
pub fn shrink_to(&mut self, min_capacity: usize) {
618618
self.buf.shrink_to_fit(cmp::max(self.len, min_capacity));
619619
}

0 commit comments

Comments
 (0)