Skip to content

Commit e873984

Browse files
Rollup merge of rust-lang#55736 - estebank:elide-anon-lt, r=petrochenkov
Elide anon lifetimes in conflicting impl note Fix rust-lang#54690.
2 parents 8fd4e5a + 3ec837e commit e873984

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/librustc/traits/specialize/mod.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,10 @@ fn to_pretty_impl_header(tcx: TyCtxt<'_, '_, '_>, impl_def_id: DefId) -> Option<
396396
if !substs.is_noop() {
397397
types_without_default_bounds.extend(substs.types());
398398
w.push('<');
399-
w.push_str(&substs.iter().map(|k| k.to_string()).collect::<Vec<_>>().join(", "));
399+
w.push_str(&substs.iter()
400+
.map(|k| k.to_string())
401+
.filter(|k| &k[..] != "'_")
402+
.collect::<Vec<_>>().join(", "));
400403
w.push('>');
401404
}
402405

src/test/ui/coherence/coherence-impls-copy.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ LL | impl Copy for &'static NotSync {}
1414
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1515
|
1616
= note: conflicting implementation in crate `core`:
17-
- impl<'_, T> std::marker::Copy for &T
17+
- impl<T> std::marker::Copy for &T
1818
where T: ?Sized;
1919

2020
error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `&[NotSync]`:
@@ -24,7 +24,7 @@ LL | impl Copy for &'static [NotSync] {}
2424
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2525
|
2626
= note: conflicting implementation in crate `core`:
27-
- impl<'_, T> std::marker::Copy for &T
27+
- impl<T> std::marker::Copy for &T
2828
where T: ?Sized;
2929

3030
error[E0206]: the trait `Copy` may not be implemented for this type

src/test/ui/e0119/issue-28981.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | impl<Foo> Deref for Foo { } //~ ERROR must be used
55
| ^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: conflicting implementation in crate `core`:
8-
- impl<'_, T> std::ops::Deref for &T
8+
- impl<T> std::ops::Deref for &T
99
where T: ?Sized;
1010

1111
error[E0210]: type parameter `Foo` must be used as the type parameter for some local type (e.g. `MyStruct<Foo>`)

0 commit comments

Comments
 (0)