Implement associated_items api.

This commit is contained in:
makai410
2025-04-01 17:11:53 +08:00
parent eda7820be5
commit f9ef4563c2
9 changed files with 330 additions and 7 deletions

View File

@@ -18,8 +18,8 @@ use crate::ty::{
TraitDef, Ty, TyConst, TyConstId, TyKind, UintTy, VariantDef,
};
use crate::{
Crate, CrateItem, CrateItems, CrateNum, DefId, Error, Filename, ImplTraitDecls, ItemKind,
Symbol, TraitDecls, mir,
AssocItems, Crate, CrateItem, CrateItems, CrateNum, DefId, Error, Filename, ImplTraitDecls,
ItemKind, Symbol, TraitDecls, mir,
};
/// This trait defines the interface between stable_mir and the Rust compiler.
@@ -251,6 +251,9 @@ pub trait Context {
/// Get the resulting type of unary operation.
fn unop_ty(&self, un_op: UnOp, arg: Ty) -> Ty;
/// Get all associated items of a definition.
fn associated_items(&self, def_id: DefId) -> AssocItems;
}
// A thread local variable that stores a pointer to the tables mapping between TyCtxt