Skip to content

Commit 9217ef2

Browse files
committed
Auto merge of rust-lang#72080 - matthewjasper:uniform-impl-trait, r=nikomatsakis
Clean up type alias impl trait implementation - Removes special case for top-level impl trait - Removes associated opaque types - Forbid lifetime elision in let position impl trait. This is consistent with the behavior for inferred types. - Handle lifetimes in type alias impl trait more uniformly with other parameters cc rust-lang#69323 cc rust-lang#63063 Closes rust-lang#57188 Closes rust-lang#62988 Closes rust-lang#69136 Closes rust-lang#73061
2 parents 7c15f30 + af9b092 commit 9217ef2

File tree

6 files changed

+4
-6
lines changed

6 files changed

+4
-6
lines changed

clippy_lints/src/lifetimes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ impl<'a, 'tcx> Visitor<'tcx> for RefVisitor<'a, 'tcx> {
379379
TyKind::Path(ref path) => {
380380
self.collect_anonymous_lifetimes(path, ty);
381381
},
382-
TyKind::Def(item, _) => {
382+
TyKind::OpaqueDef(item, _) => {
383383
let map = self.cx.tcx.hir();
384384
if let ItemKind::OpaqueTy(ref exist_ty) = map.expect_item(item.id).kind {
385385
for bound in exist_ty.bounds {

clippy_lints/src/manual_async_fn.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ManualAsyncFn {
9999

100100
fn future_trait_ref<'tcx>(cx: &LateContext<'_, 'tcx>, ty: &'tcx Ty<'tcx>) -> Option<&'tcx TraitRef<'tcx>> {
101101
if_chain! {
102-
if let TyKind::Def(item_id, _) = ty.kind;
102+
if let TyKind::OpaqueDef(item_id, _) = ty.kind;
103103
let item = cx.tcx.hir().item(item_id.id);
104104
if let ItemKind::OpaqueTy(opaque) = &item.kind;
105105
if opaque.bounds.len() == 1;

clippy_lints/src/missing_doc.rs

-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
187187
hir::ImplItemKind::Const(..) => "an associated constant",
188188
hir::ImplItemKind::Fn(..) => "a method",
189189
hir::ImplItemKind::TyAlias(_) => "an associated type",
190-
hir::ImplItemKind::OpaqueTy(_) => "an existential type",
191190
};
192191
self.check_missing_docs_attrs(cx, &impl_item.attrs, impl_item.span, desc);
193192
}

clippy_lints/src/missing_inline.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingInline {
142142

143143
let desc = match impl_item.kind {
144144
hir::ImplItemKind::Fn(..) => "a method",
145-
hir::ImplItemKind::Const(..) | hir::ImplItemKind::TyAlias(_) | hir::ImplItemKind::OpaqueTy(_) => return,
145+
hir::ImplItemKind::Const(..) | hir::ImplItemKind::TyAlias(_) => return,
146146
};
147147

148148
let def_id = cx.tcx.hir().local_def_id(impl_item.hir_id);

clippy_lints/src/utils/hir_utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
710710
segment.ident.name.hash(&mut self.s);
711711
},
712712
},
713-
TyKind::Def(_, arg_list) => {
713+
TyKind::OpaqueDef(_, arg_list) => {
714714
for arg in *arg_list {
715715
match arg {
716716
GenericArg::Lifetime(ref l) => self.hash_lifetime(l),

clippy_lints/src/utils/inspector.rs

-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DeepCodeInspector {
6363
},
6464
hir::ImplItemKind::Fn(..) => println!("method"),
6565
hir::ImplItemKind::TyAlias(_) => println!("associated type"),
66-
hir::ImplItemKind::OpaqueTy(_) => println!("existential type"),
6766
}
6867
}
6968
// fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx

0 commit comments

Comments
 (0)