Add impl trait declarations to SMIR
This commit is contained in:
@@ -63,6 +63,10 @@ pub fn trait_def(did: DefId) -> stable_mir::ty::TraitDef {
|
||||
with_tables(|t| t.trait_def(did))
|
||||
}
|
||||
|
||||
pub fn impl_def(did: DefId) -> stable_mir::ty::ImplDef {
|
||||
with_tables(|t| t.impl_def(did))
|
||||
}
|
||||
|
||||
impl<'tcx> Tables<'tcx> {
|
||||
pub fn item_def_id(&self, item: &stable_mir::CrateItem) -> DefId {
|
||||
self.def_ids[item.0]
|
||||
@@ -72,6 +76,10 @@ impl<'tcx> Tables<'tcx> {
|
||||
self.def_ids[trait_def.0]
|
||||
}
|
||||
|
||||
pub fn impl_trait_def_id(&self, impl_def: &stable_mir::ty::ImplDef) -> DefId {
|
||||
self.def_ids[impl_def.0]
|
||||
}
|
||||
|
||||
pub fn crate_item(&mut self, did: DefId) -> stable_mir::CrateItem {
|
||||
stable_mir::CrateItem(self.create_def_id(did))
|
||||
}
|
||||
@@ -116,6 +124,10 @@ impl<'tcx> Tables<'tcx> {
|
||||
stable_mir::ty::ConstDef(self.create_def_id(did))
|
||||
}
|
||||
|
||||
pub fn impl_def(&mut self, did: DefId) -> stable_mir::ty::ImplDef {
|
||||
stable_mir::ty::ImplDef(self.create_def_id(did))
|
||||
}
|
||||
|
||||
fn create_def_id(&mut self, did: DefId) -> stable_mir::DefId {
|
||||
// FIXME: this becomes inefficient when we have too many ids
|
||||
for (i, &d) in self.def_ids.iter().enumerate() {
|
||||
|
||||
Reference in New Issue
Block a user