Auto merge of #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 #69323 cc #63063 Closes #57188 Closes #62988 Closes #69136 Closes #73061
This commit is contained in:
commit
9217ef2018
@ -379,7 +379,7 @@ impl<'a, 'tcx> Visitor<'tcx> for RefVisitor<'a, 'tcx> {
|
||||
TyKind::Path(ref path) => {
|
||||
self.collect_anonymous_lifetimes(path, ty);
|
||||
},
|
||||
TyKind::Def(item, _) => {
|
||||
TyKind::OpaqueDef(item, _) => {
|
||||
let map = self.cx.tcx.hir();
|
||||
if let ItemKind::OpaqueTy(ref exist_ty) = map.expect_item(item.id).kind {
|
||||
for bound in exist_ty.bounds {
|
||||
|
@ -99,7 +99,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ManualAsyncFn {
|
||||
|
||||
fn future_trait_ref<'tcx>(cx: &LateContext<'_, 'tcx>, ty: &'tcx Ty<'tcx>) -> Option<&'tcx TraitRef<'tcx>> {
|
||||
if_chain! {
|
||||
if let TyKind::Def(item_id, _) = ty.kind;
|
||||
if let TyKind::OpaqueDef(item_id, _) = ty.kind;
|
||||
let item = cx.tcx.hir().item(item_id.id);
|
||||
if let ItemKind::OpaqueTy(opaque) = &item.kind;
|
||||
if opaque.bounds.len() == 1;
|
||||
|
@ -187,7 +187,6 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
|
||||
hir::ImplItemKind::Const(..) => "an associated constant",
|
||||
hir::ImplItemKind::Fn(..) => "a method",
|
||||
hir::ImplItemKind::TyAlias(_) => "an associated type",
|
||||
hir::ImplItemKind::OpaqueTy(_) => "an existential type",
|
||||
};
|
||||
self.check_missing_docs_attrs(cx, &impl_item.attrs, impl_item.span, desc);
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingInline {
|
||||
|
||||
let desc = match impl_item.kind {
|
||||
hir::ImplItemKind::Fn(..) => "a method",
|
||||
hir::ImplItemKind::Const(..) | hir::ImplItemKind::TyAlias(_) | hir::ImplItemKind::OpaqueTy(_) => return,
|
||||
hir::ImplItemKind::Const(..) | hir::ImplItemKind::TyAlias(_) => return,
|
||||
};
|
||||
|
||||
let def_id = cx.tcx.hir().local_def_id(impl_item.hir_id);
|
||||
|
@ -710,7 +710,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
|
||||
segment.ident.name.hash(&mut self.s);
|
||||
},
|
||||
},
|
||||
TyKind::Def(_, arg_list) => {
|
||||
TyKind::OpaqueDef(_, arg_list) => {
|
||||
for arg in *arg_list {
|
||||
match arg {
|
||||
GenericArg::Lifetime(ref l) => self.hash_lifetime(l),
|
||||
|
@ -63,7 +63,6 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DeepCodeInspector {
|
||||
},
|
||||
hir::ImplItemKind::Fn(..) => println!("method"),
|
||||
hir::ImplItemKind::TyAlias(_) => println!("associated type"),
|
||||
hir::ImplItemKind::OpaqueTy(_) => println!("existential type"),
|
||||
}
|
||||
}
|
||||
// fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx
|
||||
|
Loading…
Reference in New Issue
Block a user