-
-fn proc_macro_def_path_table(proc_macros: &[(ast::Name, Rc<SyntaxExtension>)]) -> DefPathTable {
- let mut table = DefPathTable::new();
- let root = DefKey {
- parent: None,
- disambiguated_data: DisambiguatedDefPathData {
- data: DefPathData::CrateRoot,
- disambiguator: 0,
- },
- };
-
- let initial_hash = DefKey::root_parent_stable_hash("", "");
- let root_hash = root.compute_stable_hash(initial_hash);
- let root_id = table.allocate(root, root_hash, ITEM_LIKE_SPACE);
- let root_path_hash = table.def_path_hash(root_id);
- for proc_macro in proc_macros {
- let key = DefKey {
- parent: Some(CRATE_DEF_INDEX),
- disambiguated_data: DisambiguatedDefPathData {
- data: DefPathData::MacroDef(proc_macro.0),
- disambiguator: 0,
- },
- };
- let def_path_hash = key.compute_stable_hash(root_path_hash);
- table.allocate(key, def_path_hash, ITEM_LIKE_SPACE);
- }
- table
-}