Skip to content

Commit ff5dc27

Browse files
committed
Auto merge of #58578 - kennytm:rollup, r=kennytm
Rollup of 24 pull requests Successful merges: - #56470 (Modify doctest's auto-`fn main()` to allow `Result`s) - #58044 (Make overflowing and wrapping negation const) - #58303 (Improve stability tags display) - #58336 (Fix search results interactions) - #58384 (Fix tables display) - #58392 (Use less explicit shifting in std::net::ip) - #58409 (rustdoc: respect alternate flag when formatting impl trait) - #58456 (Remove no longer accurate diagnostic code about NLL) - #58528 (Don't use an allocation for ItemId in StmtKind) - #58530 (Monomorphize less code in fs::{read|write}) - #58534 (Mention capping forbid lints) - #58536 (Remove UB in pointer tests) - #58538 (Add missing fmt structs examples) - #58539 (Add alias methods to PathBuf for underlying OsString (#58234)) - #58544 (Fix doc for rustc "-g" flag) - #58545 (Add regression test for a specialization-related ICE (#39448)) - #58546 (librustc_codegen_llvm => 2018) - #58551 (Explain a panic in test case net::tcp::tests::double_bind) - #58553 (Use more impl header lifetime elision) - #58562 (Fix style nits) - #58565 (Fix typo in std::future::Future docs) - #58568 (Fix a transposition in driver.rs.) - #58569 (Reduce Some Code Repetitions like `(n << amt) >> amt`) - #58576 (Stabilize iter::successors and iter::from_fn)
2 parents 74e35d2 + a1a17f5 commit ff5dc27

File tree

114 files changed

+1177
-633
lines changed

Some content is hidden

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

114 files changed

+1177
-633
lines changed

src/doc/rustc/src/command-line-arguments.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ This flag prints out various information about the compiler.
4242

4343
## `-g`: include debug information
4444

45-
A synonym for `-C debug-level=2`.
45+
A synonym for `-C debuginfo=2`, for more see [here](codegen-options/index.html#debuginfo).
4646

4747
## `-O`: optimize your code
4848

49-
A synonym for `-C opt-level=2`.
49+
A synonym for `-C opt-level=2`, for more see [here](codegen-options/index.html#opt-level).
5050

5151
## `-o`: filename of the output
5252

src/doc/rustc/src/lints/levels.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ This lint level gives you that.
9090
'forbid' is a special lint level that's stronger than 'deny'. It's the same
9191
as 'deny' in that a lint at this level will produce an error, but unlike the
9292
'deny' level, the 'forbid' level can not be overridden to be anything lower
93-
than an error.
93+
than an error. However, lint levels may still be capped with `--cap-lints`
94+
(see below) so `rustc --cap-lints warn` will make lints set to 'forbid' just
95+
warn.
9496

9597
## Configuring warning levels
9698

src/doc/rustdoc/src/documentation-tests.md

+17
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,23 @@ appears to the reader as the initial idea but works with doc tests:
236236
/// ```
237237
```
238238

239+
As of version 1.34.0, one can also omit the `fn main()`, but you will have to
240+
disambiguate the error type:
241+
242+
```ignore
243+
/// ```
244+
/// use std::io;
245+
/// let mut input = String::new();
246+
/// io::stdin().read_line(&mut input)?;
247+
/// # Ok::<(), io:Error>(())
248+
/// ```
249+
```
250+
251+
This is an unfortunate consequence of the `?` operator adding an implicit
252+
conversion, so type inference fails because the type is not unique. Please note
253+
that you must write the `(())` in one sequence without intermediate whitespace
254+
so that rustdoc understands you want an implicit `Result`-returning function.
255+
239256
## Documenting macros
240257

241258
Here’s an example of documenting a macro:

src/liballoc/borrow.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ pub enum Cow<'a, B: ?Sized + 'a>
182182
}
183183

184184
#[stable(feature = "rust1", since = "1.0.0")]
185-
impl<'a, B: ?Sized + ToOwned> Clone for Cow<'a, B> {
186-
fn clone(&self) -> Cow<'a, B> {
185+
impl<B: ?Sized + ToOwned> Clone for Cow<'_, B> {
186+
fn clone(&self) -> Self {
187187
match *self {
188188
Borrowed(b) => Borrowed(b),
189189
Owned(ref o) => {
@@ -193,7 +193,7 @@ impl<'a, B: ?Sized + ToOwned> Clone for Cow<'a, B> {
193193
}
194194
}
195195

196-
fn clone_from(&mut self, source: &Cow<'a, B>) {
196+
fn clone_from(&mut self, source: &Self) {
197197
if let Owned(ref mut dest) = *self {
198198
if let Owned(ref o) = *source {
199199
o.borrow().clone_into(dest);
@@ -296,11 +296,11 @@ impl<B: ?Sized + ToOwned> Deref for Cow<'_, B> {
296296
impl<B: ?Sized> Eq for Cow<'_, B> where B: Eq + ToOwned {}
297297

298298
#[stable(feature = "rust1", since = "1.0.0")]
299-
impl<'a, B: ?Sized> Ord for Cow<'a, B>
299+
impl<B: ?Sized> Ord for Cow<'_, B>
300300
where B: Ord + ToOwned
301301
{
302302
#[inline]
303-
fn cmp(&self, other: &Cow<'a, B>) -> Ordering {
303+
fn cmp(&self, other: &Self) -> Ordering {
304304
Ord::cmp(&**self, &**other)
305305
}
306306
}
@@ -353,18 +353,18 @@ impl<B: ?Sized> fmt::Display for Cow<'_, B>
353353
}
354354

355355
#[stable(feature = "default", since = "1.11.0")]
356-
impl<'a, B: ?Sized> Default for Cow<'a, B>
356+
impl<B: ?Sized> Default for Cow<'_, B>
357357
where B: ToOwned,
358358
<B as ToOwned>::Owned: Default
359359
{
360360
/// Creates an owned Cow<'a, B> with the default value for the contained owned value.
361-
fn default() -> Cow<'a, B> {
361+
fn default() -> Self {
362362
Owned(<B as ToOwned>::Owned::default())
363363
}
364364
}
365365

366366
#[stable(feature = "rust1", since = "1.0.0")]
367-
impl<'a, B: ?Sized> Hash for Cow<'a, B>
367+
impl<B: ?Sized> Hash for Cow<'_, B>
368368
where B: Hash + ToOwned
369369
{
370370
#[inline]

src/liballoc/collections/binary_heap.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -947,8 +947,8 @@ impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> {
947947

948948
// FIXME(#26925) Remove in favor of `#[derive(Clone)]`
949949
#[stable(feature = "rust1", since = "1.0.0")]
950-
impl<'a, T> Clone for Iter<'a, T> {
951-
fn clone(&self) -> Iter<'a, T> {
950+
impl<T> Clone for Iter<'_, T> {
951+
fn clone(&self) -> Self {
952952
Iter { iter: self.iter.clone() }
953953
}
954954
}

src/liballoc/collections/btree/map.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -1218,8 +1218,8 @@ impl<K, V> ExactSizeIterator for Iter<'_, K, V> {
12181218
}
12191219

12201220
#[stable(feature = "rust1", since = "1.0.0")]
1221-
impl<'a, K, V> Clone for Iter<'a, K, V> {
1222-
fn clone(&self) -> Iter<'a, K, V> {
1221+
impl<K, V> Clone for Iter<'_, K, V> {
1222+
fn clone(&self) -> Self {
12231223
Iter {
12241224
range: self.range.clone(),
12251225
length: self.length,
@@ -1441,8 +1441,8 @@ impl<K, V> ExactSizeIterator for Keys<'_, K, V> {
14411441
impl<K, V> FusedIterator for Keys<'_, K, V> {}
14421442

14431443
#[stable(feature = "rust1", since = "1.0.0")]
1444-
impl<'a, K, V> Clone for Keys<'a, K, V> {
1445-
fn clone(&self) -> Keys<'a, K, V> {
1444+
impl<K, V> Clone for Keys<'_, K, V> {
1445+
fn clone(&self) -> Self {
14461446
Keys { inner: self.inner.clone() }
14471447
}
14481448
}
@@ -1478,8 +1478,8 @@ impl<K, V> ExactSizeIterator for Values<'_, K, V> {
14781478
impl<K, V> FusedIterator for Values<'_, K, V> {}
14791479

14801480
#[stable(feature = "rust1", since = "1.0.0")]
1481-
impl<'a, K, V> Clone for Values<'a, K, V> {
1482-
fn clone(&self) -> Values<'a, K, V> {
1481+
impl<K, V> Clone for Values<'_, K, V> {
1482+
fn clone(&self) -> Self {
14831483
Values { inner: self.inner.clone() }
14841484
}
14851485
}
@@ -1606,8 +1606,8 @@ impl<'a, K, V> Range<'a, K, V> {
16061606
impl<K, V> FusedIterator for Range<'_, K, V> {}
16071607

16081608
#[stable(feature = "btree_range", since = "1.17.0")]
1609-
impl<'a, K, V> Clone for Range<'a, K, V> {
1610-
fn clone(&self) -> Range<'a, K, V> {
1609+
impl<K, V> Clone for Range<'_, K, V> {
1610+
fn clone(&self) -> Self {
16111611
Range {
16121612
front: self.front,
16131613
back: self.back,

src/liballoc/collections/btree/set.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -907,8 +907,8 @@ impl<T: Debug> Debug for BTreeSet<T> {
907907
}
908908

909909
#[stable(feature = "rust1", since = "1.0.0")]
910-
impl<'a, T> Clone for Iter<'a, T> {
911-
fn clone(&self) -> Iter<'a, T> {
910+
impl<T> Clone for Iter<'_, T> {
911+
fn clone(&self) -> Self {
912912
Iter { iter: self.iter.clone() }
913913
}
914914
}
@@ -963,8 +963,8 @@ impl<T> ExactSizeIterator for IntoIter<T> {
963963
impl<T> FusedIterator for IntoIter<T> {}
964964

965965
#[stable(feature = "btree_range", since = "1.17.0")]
966-
impl<'a, T> Clone for Range<'a, T> {
967-
fn clone(&self) -> Range<'a, T> {
966+
impl<T> Clone for Range<'_, T> {
967+
fn clone(&self) -> Self {
968968
Range { iter: self.iter.clone() }
969969
}
970970
}
@@ -998,8 +998,8 @@ fn cmp_opt<T: Ord>(x: Option<&T>, y: Option<&T>, short: Ordering, long: Ordering
998998
}
999999

10001000
#[stable(feature = "rust1", since = "1.0.0")]
1001-
impl<'a, T> Clone for Difference<'a, T> {
1002-
fn clone(&self) -> Difference<'a, T> {
1001+
impl<T> Clone for Difference<'_, T> {
1002+
fn clone(&self) -> Self {
10031003
Difference {
10041004
a: self.a.clone(),
10051005
b: self.b.clone(),
@@ -1036,8 +1036,8 @@ impl<'a, T: Ord> Iterator for Difference<'a, T> {
10361036
impl<T: Ord> FusedIterator for Difference<'_, T> {}
10371037

10381038
#[stable(feature = "rust1", since = "1.0.0")]
1039-
impl<'a, T> Clone for SymmetricDifference<'a, T> {
1040-
fn clone(&self) -> SymmetricDifference<'a, T> {
1039+
impl<T> Clone for SymmetricDifference<'_, T> {
1040+
fn clone(&self) -> Self {
10411041
SymmetricDifference {
10421042
a: self.a.clone(),
10431043
b: self.b.clone(),
@@ -1070,8 +1070,8 @@ impl<'a, T: Ord> Iterator for SymmetricDifference<'a, T> {
10701070
impl<T: Ord> FusedIterator for SymmetricDifference<'_, T> {}
10711071

10721072
#[stable(feature = "rust1", since = "1.0.0")]
1073-
impl<'a, T> Clone for Intersection<'a, T> {
1074-
fn clone(&self) -> Intersection<'a, T> {
1073+
impl<T> Clone for Intersection<'_, T> {
1074+
fn clone(&self) -> Self {
10751075
Intersection {
10761076
a: self.a.clone(),
10771077
b: self.b.clone(),
@@ -1108,8 +1108,8 @@ impl<'a, T: Ord> Iterator for Intersection<'a, T> {
11081108
impl<T: Ord> FusedIterator for Intersection<'_, T> {}
11091109

11101110
#[stable(feature = "rust1", since = "1.0.0")]
1111-
impl<'a, T> Clone for Union<'a, T> {
1112-
fn clone(&self) -> Union<'a, T> {
1111+
impl<T> Clone for Union<'_, T> {
1112+
fn clone(&self) -> Self {
11131113
Union {
11141114
a: self.a.clone(),
11151115
b: self.b.clone(),

src/liballoc/collections/linked_list.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1200,16 +1200,16 @@ unsafe impl<T: Send> Send for LinkedList<T> {}
12001200
unsafe impl<T: Sync> Sync for LinkedList<T> {}
12011201

12021202
#[stable(feature = "rust1", since = "1.0.0")]
1203-
unsafe impl<'a, T: Sync> Send for Iter<'a, T> {}
1203+
unsafe impl<T: Sync> Send for Iter<'_, T> {}
12041204

12051205
#[stable(feature = "rust1", since = "1.0.0")]
1206-
unsafe impl<'a, T: Sync> Sync for Iter<'a, T> {}
1206+
unsafe impl<T: Sync> Sync for Iter<'_, T> {}
12071207

12081208
#[stable(feature = "rust1", since = "1.0.0")]
1209-
unsafe impl<'a, T: Send> Send for IterMut<'a, T> {}
1209+
unsafe impl<T: Send> Send for IterMut<'_, T> {}
12101210

12111211
#[stable(feature = "rust1", since = "1.0.0")]
1212-
unsafe impl<'a, T: Sync> Sync for IterMut<'a, T> {}
1212+
unsafe impl<T: Sync> Sync for IterMut<'_, T> {}
12131213

12141214
#[cfg(test)]
12151215
mod tests {

src/liballoc/collections/vec_deque.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2132,8 +2132,8 @@ impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> {
21322132

21332133
// FIXME(#26925) Remove in favor of `#[derive(Clone)]`
21342134
#[stable(feature = "rust1", since = "1.0.0")]
2135-
impl<'a, T> Clone for Iter<'a, T> {
2136-
fn clone(&self) -> Iter<'a, T> {
2135+
impl<T> Clone for Iter<'_, T> {
2136+
fn clone(&self) -> Self {
21372137
Iter {
21382138
ring: self.ring,
21392139
tail: self.tail,
@@ -2225,7 +2225,7 @@ pub struct IterMut<'a, T: 'a> {
22252225
}
22262226

22272227
#[stable(feature = "collection_debug", since = "1.17.0")]
2228-
impl<'a, T: fmt::Debug> fmt::Debug for IterMut<'_, T> {
2228+
impl<T: fmt::Debug> fmt::Debug for IterMut<'_, T> {
22292229
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
22302230
let (front, back) = RingSlices::ring_slices(&*self.ring, self.head, self.tail);
22312231
f.debug_tuple("IterMut")

src/liballoc/vec.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2455,7 +2455,7 @@ pub struct Drain<'a, T: 'a> {
24552455
}
24562456

24572457
#[stable(feature = "collection_debug", since = "1.17.0")]
2458-
impl<'a, T: 'a + fmt::Debug> fmt::Debug for Drain<'a, T> {
2458+
impl<T: fmt::Debug> fmt::Debug for Drain<'_, T> {
24592459
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
24602460
f.debug_tuple("Drain")
24612461
.field(&self.iter.as_slice())

0 commit comments

Comments
 (0)