Change item collection to be on demand

This commit is contained in:
Celina G. Val
2023-03-07 12:47:25 -08:00
parent b66db7e4e0
commit 5eaeb71b9f
4 changed files with 38 additions and 33 deletions

View File

@@ -31,8 +31,6 @@ pub struct Crate {
pub(crate) id: CrateNum,
pub name: Symbol,
pub is_local: bool,
/// The items defined in the root of this crate.
pub root_items: CrateItems,
}
/// Holds information about an item in the crate.
@@ -50,3 +48,13 @@ pub fn local_crate() -> Crate {
pub fn find_crate(name: &str) -> Option<Crate> {
crate::rustc_smir::find_crate(name)
}
/// Try to find a crate with the given name.
pub fn external_crates() -> Vec<Crate> {
crate::rustc_smir::external_crates()
}
/// Retrieve all items in the local crate that have a MIR associated with them.
pub fn all_local_items() -> CrateItems {
crate::rustc_smir::all_local_items()
}