pub fn create_root_def(&mut self,
                           crate_name: &str,
                           crate_disambiguator: CrateDisambiguator)
                           -> DefIndex {
        let key = DefKey {
            parent: None,
            disambiguated_data: DisambiguatedDefPathData {
                data: DefPathData::CrateRoot,
                disambiguator: 0
            }
        };

        let parent_hash = DefKey::root_parent_stable_hash(crate_name,
                                                          crate_disambiguator);
        let def_path_hash = key.compute_stable_hash(parent_hash);

        // Create the definition.
        let root_index = self.table.allocate(key, def_path_hash);
        assert_eq!(root_index, CRATE_DEF_INDEX);
        assert!(self.def_index_to_node.is_empty());
        self.def_index_to_node.push(ast::CRATE_NODE_ID);
        self.node_to_def_index.insert(ast::CRATE_NODE_ID, root_index);
        self.set_invocation_parent(ExpnId::root(), root_index);

        // Allocate some other `DefIndex`es that always must exist.
        GlobalMetaDataKind::allocate_def_indices(self);

        root_index
    }
/// Adds a root definition (no parent) and a few other reserved definitions.
Adds a root definition (no parent) and a few other reserved definitions.
Adds a root definition ( no parent ) and a few other reserved definitions .
pub fn create_root_def(&mut self,
                           crate_name: &str,
                           crate_disambiguator: CrateDisambiguator)
                           -> DefIndex {
        let key = DefKey {
            parent: None,
            disambiguated_data: DisambiguatedDefPathData {
                data: DefPathData::CrateRoot,
                disambiguator: 0
            }
        };
        let parent_hash = DefKey::root_parent_stable_hash(crate_name,
                                                          crate_disambiguator);
        let def_path_hash = key.compute_stable_hash(parent_hash);
        // Create the definition.
        let root_index = self.table.allocate(key, def_path_hash);
        assert_eq!(root_index, CRATE_DEF_INDEX);
        assert!(self.def_index_to_node.is_empty());
        self.def_index_to_node.push(ast::CRATE_NODE_ID);
        self.node_to_def_index.insert(ast::CRATE_NODE_ID, root_index);
        self.set_invocation_parent(ExpnId::root(), root_index);
        // Allocate some other `DefIndex`es that always must exist.
        GlobalMetaDataKind::allocate_def_indices(self);
        root_index
    }
pub fn create_root_def ( & mut self , crate_name : & str , crate_disambiguator : CrateDisambiguator ) -> DefIndex { let key = DefKey { parent : None , disambiguated_data : DisambiguatedDefPathData { data : DefPathData :: CrateRoot , disambiguator : 0 } } ; let parent_hash = DefKey :: root_parent_stable_hash ( crate_name , crate_disambiguator ) ; let def_path_hash = key . compute_stable_hash ( parent_hash ) ; // Create the definition. let root_index = self . table . allocate ( key , def_path_hash ) ; assert_eq ! ( root_index CRATE_DEF_INDEX ) ; assert ! ( self def_index_to_node is_empty ( ) ) ; self . def_index_to_node . push ( ast :: CRATE_NODE_ID ) ; self . node_to_def_index . insert ( ast :: CRATE_NODE_ID , root_index ) ; self . set_invocation_parent ( ExpnId :: root ( ) , root_index ) ; // Allocate some other `DefIndex`es that always must exist. GlobalMetaDataKind :: allocate_def_indices ( self ) ; root_index }
Adds a root definition (no parent) and a few other reserved definitions.
Adds a root definition ( no parent ) and a few other reserved definitions .
&mut self
crate_name
&str
crate_disambiguator
CrateDisambiguator
&mut self
crate_name
&str
crate_disambiguator
CrateDisambiguator