Move opt_rpitit_info field to hir::AssocKind::Type.
From `hir::AssocItem`.
This commit is contained in:
@@ -188,7 +188,7 @@ fn bounds_reference_self(tcx: TyCtxt<'_>, trait_def_id: DefId) -> SmallVec<[Span
|
||||
tcx.associated_items(trait_def_id)
|
||||
.in_definition_order()
|
||||
// We're only looking at associated type bounds
|
||||
.filter(|item| item.kind == ty::AssocKind::Type)
|
||||
.filter(|item| item.is_type())
|
||||
// Ignore GATs with `Self: Sized`
|
||||
.filter(|item| !tcx.generics_require_sized_self(item.def_id))
|
||||
.flat_map(|item| tcx.explicit_item_bounds(item.def_id).iter_identity_copied())
|
||||
@@ -320,7 +320,7 @@ pub fn dyn_compatibility_violations_for_assoc_item(
|
||||
})
|
||||
.collect(),
|
||||
// Associated types can only be dyn-compatible if they have `Self: Sized` bounds.
|
||||
ty::AssocKind::Type => {
|
||||
ty::AssocKind::Type { .. } => {
|
||||
if !tcx.generics_of(item.def_id).is_own_empty() && !item.is_impl_trait_in_trait() {
|
||||
vec![DynCompatibilityViolation::GAT(item.name, item.ident(tcx).span)]
|
||||
} else {
|
||||
|
||||
@@ -594,9 +594,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
// Associated types that require `Self: Sized` do not show up in the built-in
|
||||
// implementation of `Trait for dyn Trait`, and can be dropped here.
|
||||
.filter(|item| !tcx.generics_require_sized_self(item.def_id))
|
||||
.filter_map(
|
||||
|item| if item.kind == ty::AssocKind::Type { Some(item.def_id) } else { None },
|
||||
)
|
||||
.filter_map(|item| if item.is_type() { Some(item.def_id) } else { None })
|
||||
.collect();
|
||||
|
||||
for assoc_type in assoc_types {
|
||||
|
||||
Reference in New Issue
Block a user