Skip to content

Commit 4cf1176

Browse files
committed
Auto merge of #54767 - pietroalbini:rollup, r=pietroalbini
Rollup of 10 pull requests Successful merges: - #54269 (#53840: Consolidate pattern check errors) - #54458 (Allow both explicit and elided lifetimes in the same impl header) - #54603 (Add `crate::` to trait suggestions in Rust 2018.) - #54648 (Update Cargo's submodule) - #54680 (make run-pass tests with empty main just compile-pass tests) - #54687 (Use impl_header_lifetime_elision in libcore) - #54699 (Re-export `getopts` so custom drivers can reference it.) - #54702 (do not promote comparing function pointers) - #54728 (Renumber `proc_macro` tracking issues) - #54745 (make `CStr::from_bytes_with_nul_unchecked()` a const fn) Failed merges: r? @ghost
2 parents 2bd5993 + 00e4b27 commit 4cf1176

File tree

281 files changed

+937
-538
lines changed

Some content is hidden

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

281 files changed

+937
-538
lines changed

src/Cargo.lock

+81-26
Large diffs are not rendered by default.

src/libcore/borrow.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -226,16 +226,16 @@ impl<T: ?Sized> BorrowMut<T> for T {
226226
}
227227

228228
#[stable(feature = "rust1", since = "1.0.0")]
229-
impl<'a, T: ?Sized> Borrow<T> for &'a T {
229+
impl<T: ?Sized> Borrow<T> for &T {
230230
fn borrow(&self) -> &T { &**self }
231231
}
232232

233233
#[stable(feature = "rust1", since = "1.0.0")]
234-
impl<'a, T: ?Sized> Borrow<T> for &'a mut T {
234+
impl<T: ?Sized> Borrow<T> for &mut T {
235235
fn borrow(&self) -> &T { &**self }
236236
}
237237

238238
#[stable(feature = "rust1", since = "1.0.0")]
239-
impl<'a, T: ?Sized> BorrowMut<T> for &'a mut T {
239+
impl<T: ?Sized> BorrowMut<T> for &mut T {
240240
fn borrow_mut(&mut self) -> &mut T { &mut **self }
241241
}

src/libcore/cell.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -1092,7 +1092,7 @@ impl<'b> BorrowRef<'b> {
10921092
}
10931093
}
10941094

1095-
impl<'b> Drop for BorrowRef<'b> {
1095+
impl Drop for BorrowRef<'_> {
10961096
#[inline]
10971097
fn drop(&mut self) {
10981098
let borrow = self.borrow.get();
@@ -1101,9 +1101,9 @@ impl<'b> Drop for BorrowRef<'b> {
11011101
}
11021102
}
11031103

1104-
impl<'b> Clone for BorrowRef<'b> {
1104+
impl Clone for BorrowRef<'_> {
11051105
#[inline]
1106-
fn clone(&self) -> BorrowRef<'b> {
1106+
fn clone(&self) -> Self {
11071107
// Since this Ref exists, we know the borrow flag
11081108
// is a reading borrow.
11091109
let borrow = self.borrow.get();
@@ -1127,7 +1127,7 @@ pub struct Ref<'b, T: ?Sized + 'b> {
11271127
}
11281128

11291129
#[stable(feature = "rust1", since = "1.0.0")]
1130-
impl<'b, T: ?Sized> Deref for Ref<'b, T> {
1130+
impl<T: ?Sized> Deref for Ref<'_, T> {
11311131
type Target = T;
11321132

11331133
#[inline]
@@ -1219,7 +1219,7 @@ impl<'b, T: ?Sized> Ref<'b, T> {
12191219
impl<'b, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Ref<'b, U>> for Ref<'b, T> {}
12201220

12211221
#[stable(feature = "std_guard_impls", since = "1.20.0")]
1222-
impl<'a, T: ?Sized + fmt::Display> fmt::Display for Ref<'a, T> {
1222+
impl<T: ?Sized + fmt::Display> fmt::Display for Ref<'_, T> {
12231223
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
12241224
self.value.fmt(f)
12251225
}
@@ -1305,7 +1305,7 @@ struct BorrowRefMut<'b> {
13051305
borrow: &'b Cell<BorrowFlag>,
13061306
}
13071307

1308-
impl<'b> Drop for BorrowRefMut<'b> {
1308+
impl Drop for BorrowRefMut<'_> {
13091309
#[inline]
13101310
fn drop(&mut self) {
13111311
let borrow = self.borrow.get();
@@ -1356,7 +1356,7 @@ pub struct RefMut<'b, T: ?Sized + 'b> {
13561356
}
13571357

13581358
#[stable(feature = "rust1", since = "1.0.0")]
1359-
impl<'b, T: ?Sized> Deref for RefMut<'b, T> {
1359+
impl<T: ?Sized> Deref for RefMut<'_, T> {
13601360
type Target = T;
13611361

13621362
#[inline]
@@ -1366,7 +1366,7 @@ impl<'b, T: ?Sized> Deref for RefMut<'b, T> {
13661366
}
13671367

13681368
#[stable(feature = "rust1", since = "1.0.0")]
1369-
impl<'b, T: ?Sized> DerefMut for RefMut<'b, T> {
1369+
impl<T: ?Sized> DerefMut for RefMut<'_, T> {
13701370
#[inline]
13711371
fn deref_mut(&mut self) -> &mut T {
13721372
self.value
@@ -1377,7 +1377,7 @@ impl<'b, T: ?Sized> DerefMut for RefMut<'b, T> {
13771377
impl<'b, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<RefMut<'b, U>> for RefMut<'b, T> {}
13781378

13791379
#[stable(feature = "std_guard_impls", since = "1.20.0")]
1380-
impl<'a, T: ?Sized + fmt::Display> fmt::Display for RefMut<'a, T> {
1380+
impl<T: ?Sized + fmt::Display> fmt::Display for RefMut<'_, T> {
13811381
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
13821382
self.value.fmt(f)
13831383
}

src/libcore/clone.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ mod impls {
204204

205205
// Shared references can be cloned, but mutable references *cannot*!
206206
#[stable(feature = "rust1", since = "1.0.0")]
207-
impl<'a, T: ?Sized> Clone for &'a T {
207+
impl<T: ?Sized> Clone for &T {
208208
#[inline]
209209
fn clone(&self) -> Self {
210210
*self

src/libcore/cmp.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1033,12 +1033,12 @@ mod impls {
10331033
fn gt(&self, other: & &'b B) -> bool { PartialOrd::gt(*self, *other) }
10341034
}
10351035
#[stable(feature = "rust1", since = "1.0.0")]
1036-
impl<'a, A: ?Sized> Ord for &'a A where A: Ord {
1036+
impl<A: ?Sized> Ord for &A where A: Ord {
10371037
#[inline]
1038-
fn cmp(&self, other: & &'a A) -> Ordering { Ord::cmp(*self, *other) }
1038+
fn cmp(&self, other: &Self) -> Ordering { Ord::cmp(*self, *other) }
10391039
}
10401040
#[stable(feature = "rust1", since = "1.0.0")]
1041-
impl<'a, A: ?Sized> Eq for &'a A where A: Eq {}
1041+
impl<A: ?Sized> Eq for &A where A: Eq {}
10421042

10431043
// &mut pointers
10441044

@@ -1065,12 +1065,12 @@ mod impls {
10651065
fn gt(&self, other: &&'b mut B) -> bool { PartialOrd::gt(*self, *other) }
10661066
}
10671067
#[stable(feature = "rust1", since = "1.0.0")]
1068-
impl<'a, A: ?Sized> Ord for &'a mut A where A: Ord {
1068+
impl<A: ?Sized> Ord for &mut A where A: Ord {
10691069
#[inline]
1070-
fn cmp(&self, other: &&'a mut A) -> Ordering { Ord::cmp(*self, *other) }
1070+
fn cmp(&self, other: &Self) -> Ordering { Ord::cmp(*self, *other) }
10711071
}
10721072
#[stable(feature = "rust1", since = "1.0.0")]
1073-
impl<'a, A: ?Sized> Eq for &'a mut A where A: Eq {}
1073+
impl<A: ?Sized> Eq for &mut A where A: Eq {}
10741074

10751075
#[stable(feature = "rust1", since = "1.0.0")]
10761076
impl<'a, 'b, A: ?Sized, B: ?Sized> PartialEq<&'b mut B> for &'a A where A: PartialEq<B> {

src/libcore/convert.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ pub trait TryFrom<T>: Sized {
407407

408408
// As lifts over &
409409
#[stable(feature = "rust1", since = "1.0.0")]
410-
impl<'a, T: ?Sized, U: ?Sized> AsRef<U> for &'a T where T: AsRef<U>
410+
impl<T: ?Sized, U: ?Sized> AsRef<U> for &T where T: AsRef<U>
411411
{
412412
fn as_ref(&self) -> &U {
413413
<T as AsRef<U>>::as_ref(*self)
@@ -416,7 +416,7 @@ impl<'a, T: ?Sized, U: ?Sized> AsRef<U> for &'a T where T: AsRef<U>
416416

417417
// As lifts over &mut
418418
#[stable(feature = "rust1", since = "1.0.0")]
419-
impl<'a, T: ?Sized, U: ?Sized> AsRef<U> for &'a mut T where T: AsRef<U>
419+
impl<T: ?Sized, U: ?Sized> AsRef<U> for &mut T where T: AsRef<U>
420420
{
421421
fn as_ref(&self) -> &U {
422422
<T as AsRef<U>>::as_ref(*self)
@@ -433,7 +433,7 @@ impl<'a, T: ?Sized, U: ?Sized> AsRef<U> for &'a mut T where T: AsRef<U>
433433

434434
// AsMut lifts over &mut
435435
#[stable(feature = "rust1", since = "1.0.0")]
436-
impl<'a, T: ?Sized, U: ?Sized> AsMut<U> for &'a mut T where T: AsMut<U>
436+
impl<T: ?Sized, U: ?Sized> AsMut<U> for &mut T where T: AsMut<U>
437437
{
438438
fn as_mut(&mut self) -> &mut U {
439439
(*self).as_mut()

src/libcore/fmt/builders.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ impl<'a> PadAdapter<'a> {
2828
}
2929
}
3030

31-
impl<'a> fmt::Write for PadAdapter<'a> {
31+
impl fmt::Write for PadAdapter<'_> {
3232
fn write_str(&mut self, mut s: &str) -> fmt::Result {
3333
while !s.is_empty() {
3434
if self.on_newline {

src/libcore/fmt/mod.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ pub trait Write {
208208
// requiring a `Sized` bound.
209209
struct Adapter<'a,T: ?Sized +'a>(&'a mut T);
210210

211-
impl<'a, T: ?Sized> Write for Adapter<'a, T>
211+
impl<T: ?Sized> Write for Adapter<'_, T>
212212
where T: Write
213213
{
214214
fn write_str(&mut self, s: &str) -> Result {
@@ -229,7 +229,7 @@ pub trait Write {
229229
}
230230

231231
#[stable(feature = "fmt_write_blanket_impl", since = "1.4.0")]
232-
impl<'a, W: Write + ?Sized> Write for &'a mut W {
232+
impl<W: Write + ?Sized> Write for &mut W {
233233
fn write_str(&mut self, s: &str) -> Result {
234234
(**self).write_str(s)
235235
}
@@ -291,8 +291,8 @@ pub struct ArgumentV1<'a> {
291291

292292
#[unstable(feature = "fmt_internals", reason = "internal to format_args!",
293293
issue = "0")]
294-
impl<'a> Clone for ArgumentV1<'a> {
295-
fn clone(&self) -> ArgumentV1<'a> {
294+
impl Clone for ArgumentV1<'_> {
295+
fn clone(&self) -> Self {
296296
*self
297297
}
298298
}
@@ -436,14 +436,14 @@ pub struct Arguments<'a> {
436436
}
437437

438438
#[stable(feature = "rust1", since = "1.0.0")]
439-
impl<'a> Debug for Arguments<'a> {
439+
impl Debug for Arguments<'_> {
440440
fn fmt(&self, fmt: &mut Formatter) -> Result {
441441
Display::fmt(self, fmt)
442442
}
443443
}
444444

445445
#[stable(feature = "rust1", since = "1.0.0")]
446-
impl<'a> Display for Arguments<'a> {
446+
impl Display for Arguments<'_> {
447447
fn fmt(&self, fmt: &mut Formatter) -> Result {
448448
write(fmt.buf, *self)
449449
}
@@ -1884,7 +1884,7 @@ impl<'a> Formatter<'a> {
18841884
}
18851885

18861886
#[stable(since = "1.2.0", feature = "formatter_write")]
1887-
impl<'a> Write for Formatter<'a> {
1887+
impl Write for Formatter<'_> {
18881888
fn write_str(&mut self, s: &str) -> Result {
18891889
self.buf.write_str(s)
18901890
}
@@ -1911,11 +1911,11 @@ macro_rules! fmt_refs {
19111911
($($tr:ident),*) => {
19121912
$(
19131913
#[stable(feature = "rust1", since = "1.0.0")]
1914-
impl<'a, T: ?Sized + $tr> $tr for &'a T {
1914+
impl<T: ?Sized + $tr> $tr for &T {
19151915
fn fmt(&self, f: &mut Formatter) -> Result { $tr::fmt(&**self, f) }
19161916
}
19171917
#[stable(feature = "rust1", since = "1.0.0")]
1918-
impl<'a, T: ?Sized + $tr> $tr for &'a mut T {
1918+
impl<T: ?Sized + $tr> $tr for &mut T {
19191919
fn fmt(&self, f: &mut Formatter) -> Result { $tr::fmt(&**self, f) }
19201920
}
19211921
)*
@@ -2039,14 +2039,14 @@ impl<T: ?Sized> Pointer for *mut T {
20392039
}
20402040

20412041
#[stable(feature = "rust1", since = "1.0.0")]
2042-
impl<'a, T: ?Sized> Pointer for &'a T {
2042+
impl<T: ?Sized> Pointer for &T {
20432043
fn fmt(&self, f: &mut Formatter) -> Result {
20442044
Pointer::fmt(&(*self as *const T), f)
20452045
}
20462046
}
20472047

20482048
#[stable(feature = "rust1", since = "1.0.0")]
2049-
impl<'a, T: ?Sized> Pointer for &'a mut T {
2049+
impl<T: ?Sized> Pointer for &mut T {
20502050
fn fmt(&self, f: &mut Formatter) -> Result {
20512051
Pointer::fmt(&(&**self as *const T), f)
20522052
}
@@ -2153,14 +2153,14 @@ impl<T: ?Sized + Debug> Debug for RefCell<T> {
21532153
}
21542154

21552155
#[stable(feature = "rust1", since = "1.0.0")]
2156-
impl<'b, T: ?Sized + Debug> Debug for Ref<'b, T> {
2156+
impl<T: ?Sized + Debug> Debug for Ref<'_, T> {
21572157
fn fmt(&self, f: &mut Formatter) -> Result {
21582158
Debug::fmt(&**self, f)
21592159
}
21602160
}
21612161

21622162
#[stable(feature = "rust1", since = "1.0.0")]
2163-
impl<'b, T: ?Sized + Debug> Debug for RefMut<'b, T> {
2163+
impl<T: ?Sized + Debug> Debug for RefMut<'_, T> {
21642164
fn fmt(&self, f: &mut Formatter) -> Result {
21652165
Debug::fmt(&*(self.deref()), f)
21662166
}

src/libcore/hash/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ pub trait Hasher {
361361
}
362362

363363
#[stable(feature = "indirect_hasher_impl", since = "1.22.0")]
364-
impl<'a, H: Hasher + ?Sized> Hasher for &'a mut H {
364+
impl<H: Hasher + ?Sized> Hasher for &mut H {
365365
fn finish(&self) -> u64 {
366366
(**self).finish()
367367
}
@@ -669,14 +669,14 @@ mod impls {
669669

670670

671671
#[stable(feature = "rust1", since = "1.0.0")]
672-
impl<'a, T: ?Sized + Hash> Hash for &'a T {
672+
impl<T: ?Sized + Hash> Hash for &T {
673673
fn hash<H: Hasher>(&self, state: &mut H) {
674674
(**self).hash(state);
675675
}
676676
}
677677

678678
#[stable(feature = "rust1", since = "1.0.0")]
679-
impl<'a, T: ?Sized + Hash> Hash for &'a mut T {
679+
impl<T: ?Sized + Hash> Hash for &mut T {
680680
fn hash<H: Hasher>(&self, state: &mut H) {
681681
(**self).hash(state);
682682
}

src/libcore/iter/iterator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2557,7 +2557,7 @@ fn select_fold1<I, B, FProj, FCmp>(mut it: I,
25572557
}
25582558

25592559
#[stable(feature = "rust1", since = "1.0.0")]
2560-
impl<'a, I: Iterator + ?Sized> Iterator for &'a mut I {
2560+
impl<I: Iterator + ?Sized> Iterator for &mut I {
25612561
type Item = I::Item;
25622562
fn next(&mut self) -> Option<I::Item> { (**self).next() }
25632563
fn size_hint(&self) -> (usize, Option<usize>) { (**self).size_hint() }

src/libcore/iter/traits.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ pub trait ExactSizeIterator: Iterator {
724724
}
725725

726726
#[stable(feature = "rust1", since = "1.0.0")]
727-
impl<'a, I: ExactSizeIterator + ?Sized> ExactSizeIterator for &'a mut I {
727+
impl<I: ExactSizeIterator + ?Sized> ExactSizeIterator for &mut I {
728728
fn len(&self) -> usize {
729729
(**self).len()
730730
}
@@ -974,7 +974,7 @@ impl<T, U, E> Product<Result<U, E>> for Result<T, E>
974974
pub trait FusedIterator: Iterator {}
975975

976976
#[stable(feature = "fused", since = "1.26.0")]
977-
impl<'a, I: FusedIterator + ?Sized> FusedIterator for &'a mut I {}
977+
impl<I: FusedIterator + ?Sized> FusedIterator for &mut I {}
978978

979979
/// An iterator that reports an accurate length using size_hint.
980980
///
@@ -999,4 +999,4 @@ impl<'a, I: FusedIterator + ?Sized> FusedIterator for &'a mut I {}
999999
pub unsafe trait TrustedLen : Iterator {}
10001000

10011001
#[unstable(feature = "trusted_len", issue = "37572")]
1002-
unsafe impl<'a, I: TrustedLen + ?Sized> TrustedLen for &'a mut I {}
1002+
unsafe impl<I: TrustedLen + ?Sized> TrustedLen for &mut I {}

src/libcore/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
#![feature(doc_spotlight)]
8888
#![feature(extern_types)]
8989
#![feature(fundamental)]
90+
#![feature(impl_header_lifetime_elision)]
9091
#![feature(intrinsics)]
9192
#![feature(lang_items)]
9293
#![feature(link_llvm_intrinsics)]

src/libcore/marker.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -584,9 +584,9 @@ impls! { PhantomData }
584584

585585
mod impls {
586586
#[stable(feature = "rust1", since = "1.0.0")]
587-
unsafe impl<'a, T: Sync + ?Sized> Send for &'a T {}
587+
unsafe impl<T: Sync + ?Sized> Send for &T {}
588588
#[stable(feature = "rust1", since = "1.0.0")]
589-
unsafe impl<'a, T: Send + ?Sized> Send for &'a mut T {}
589+
unsafe impl<T: Send + ?Sized> Send for &mut T {}
590590
}
591591

592592
/// Compiler-internal trait used to determine whether a type contains
@@ -600,8 +600,8 @@ impl<T: ?Sized> !Freeze for UnsafeCell<T> {}
600600
unsafe impl<T: ?Sized> Freeze for PhantomData<T> {}
601601
unsafe impl<T: ?Sized> Freeze for *const T {}
602602
unsafe impl<T: ?Sized> Freeze for *mut T {}
603-
unsafe impl<'a, T: ?Sized> Freeze for &'a T {}
604-
unsafe impl<'a, T: ?Sized> Freeze for &'a mut T {}
603+
unsafe impl<T: ?Sized> Freeze for &T {}
604+
unsafe impl<T: ?Sized> Freeze for &mut T {}
605605

606606
/// Types which can be safely moved after being pinned.
607607
///
@@ -689,6 +689,6 @@ mod copy_impls {
689689

690690
// Shared references can be copied, but mutable references *cannot*!
691691
#[stable(feature = "rust1", since = "1.0.0")]
692-
impl<'a, T: ?Sized> Copy for &'a T {}
692+
impl<T: ?Sized> Copy for &T {}
693693

694694
}

src/libcore/ops/deref.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,14 @@ pub trait Deref {
8383
}
8484

8585
#[stable(feature = "rust1", since = "1.0.0")]
86-
impl<'a, T: ?Sized> Deref for &'a T {
86+
impl<T: ?Sized> Deref for &T {
8787
type Target = T;
8888

8989
fn deref(&self) -> &T { *self }
9090
}
9191

9292
#[stable(feature = "rust1", since = "1.0.0")]
93-
impl<'a, T: ?Sized> Deref for &'a mut T {
93+
impl<T: ?Sized> Deref for &mut T {
9494
type Target = T;
9595

9696
fn deref(&self) -> &T { *self }
@@ -174,6 +174,6 @@ pub trait DerefMut: Deref {
174174
}
175175

176176
#[stable(feature = "rust1", since = "1.0.0")]
177-
impl<'a, T: ?Sized> DerefMut for &'a mut T {
177+
impl<T: ?Sized> DerefMut for &mut T {
178178
fn deref_mut(&mut self) -> &mut T { *self }
179179
}

0 commit comments

Comments
 (0)