1
Fork 0

Encode LangItem directly

This commit is contained in:
Cameron Steffen 2022-10-26 16:18:29 -05:00
parent 99de57ae13
commit ebfa1f0185
6 changed files with 21 additions and 34 deletions

View file

@ -42,7 +42,7 @@ macro_rules! expand_group {
pub struct LanguageItems {
/// Mappings from lang items to their possibly found [`DefId`]s.
/// The index corresponds to the order in [`LangItem`].
pub items: Vec<Option<DefId>>,
items: Vec<Option<DefId>>,
/// Lang items that were not found during collection.
pub missing: Vec<LangItem>,
/// Mapping from [`LangItemGroup`] discriminants to all
@ -133,11 +133,6 @@ macro_rules! language_item_table {
}
}
/// Returns the mappings to the possibly found `DefId`s for each lang item.
pub fn items(&self) -> &[Option<DefId>] {
&*self.items
}
/// Returns the [`DefId`]s of all lang items in a group.
pub fn group(&self, group: LangItemGroup) -> &[DefId] {
self.groups[group as usize].as_ref()