about summary refs log tree commit diff
path: root/compiler/rustc_ty_utils
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-02-07 00:03:02 +0000
committerbors <bors@rust-lang.org>2023-02-07 00:03:02 +0000
commit35d6d70a64d8db139a700ccfdb31824bbf4ba350 (patch)
tree974237e3bdc332244b2556b347cf945d7ed73064 /compiler/rustc_ty_utils
parente1eaa2d5d4d1f5b7b89561a940718058d414e89c (diff)
parentf4e2b954a1749bb215eb0f1365e7d1f95162d3ba (diff)
downloadrust-35d6d70a64d8db139a700ccfdb31824bbf4ba350.tar.gz
rust-35d6d70a64d8db139a700ccfdb31824bbf4ba350.zip
Auto merge of #107693 - petrochenkov:metable, r=oli-obk
rustc_metadata: Encode/decode some `LazyArrays` without an `Option`

and a couple of related changes, see individual commits.

Addresses comments in https://github.com/rust-lang/rust/pull/107166#discussion_r1083417124 and https://github.com/rust-lang/rust/pull/107166#discussion_r1083768417, cc `@cjgillot` `@oli-obk.`
Diffstat (limited to 'compiler/rustc_ty_utils')
-rw-r--r--compiler/rustc_ty_utils/src/assoc.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/rustc_ty_utils/src/assoc.rs b/compiler/rustc_ty_utils/src/assoc.rs
index 424b52309d3..a6e0f13f698 100644
--- a/compiler/rustc_ty_utils/src/assoc.rs
+++ b/compiler/rustc_ty_utils/src/assoc.rs
@@ -22,14 +22,17 @@ fn associated_item_def_ids(tcx: TyCtxt<'_>, def_id: DefId) -> &[DefId] {
         hir::ItemKind::Impl(ref impl_) => tcx.arena.alloc_from_iter(
             impl_.items.iter().map(|impl_item_ref| impl_item_ref.id.owner_id.to_def_id()),
         ),
-        hir::ItemKind::TraitAlias(..) => &[],
         _ => span_bug!(item.span, "associated_item_def_ids: not impl or trait"),
     }
 }
 
 fn associated_items(tcx: TyCtxt<'_>, def_id: DefId) -> ty::AssocItems<'_> {
-    let items = tcx.associated_item_def_ids(def_id).iter().map(|did| tcx.associated_item(*did));
-    ty::AssocItems::new(items)
+    if tcx.is_trait_alias(def_id) {
+        ty::AssocItems::new(Vec::new())
+    } else {
+        let items = tcx.associated_item_def_ids(def_id).iter().map(|did| tcx.associated_item(*did));
+        ty::AssocItems::new(items)
+    }
 }
 
 fn impl_item_implementor_ids(tcx: TyCtxt<'_>, impl_id: DefId) -> FxHashMap<DefId, DefId> {