fn resolve_crate_deps(&mut self,
                          root: &Option<CratePaths>,
                          cdata: &[u8],
                          krate: ast::CrateNum,
                          span: Span)
                          -> cstore::CrateNumMap {
        debug!("resolving deps of external crate");
        // The map from crate numbers in the crate we're resolving to local crate
        // numbers
        let map: FnvHashMap<_, _> = decoder::get_crate_deps(cdata).iter().map(|dep| {
            debug!("resolving dep crate {} hash: `{}`", dep.name, dep.hash);
            let (local_cnum, _, _) = self.resolve_crate(root,
                                                        &dep.name,
                                                        &dep.name,
                                                        Some(&dep.hash),
                                                        span,
                                                        PathKind::Dependency,
                                                        dep.explicitly_linked);
            (dep.cnum, local_cnum)
        }).collect();

        let max_cnum = map.values().cloned().max().unwrap_or(0);

        // we map 0 and all other holes in the map to our parent crate. The "additional"
        // self-dependencies should be harmless.
        (0..max_cnum+1).map(|cnum| map.get(&cnum).cloned().unwrap_or(krate)).collect()
    }
// Go through the crate metadata and load any crates that it references
Go through the crate metadata and load any crates that it references
Go through the crate metadata and load any crates that it references
fn resolve_crate_deps(&mut self,
                          root: &Option<CratePaths>,
                          cdata: &[u8],
                          krate: ast::CrateNum,
                          span: Span)
                          -> cstore::CrateNumMap {
        debug!("resolving deps of external crate");
        // The map from crate numbers in the crate we're resolving to local crate
        // numbers
        let map: FnvHashMap<_, _> = decoder::get_crate_deps(cdata).iter().map(|dep| {
            debug!("resolving dep crate {} hash: `{}`", dep.name, dep.hash);
            let (local_cnum, _, _) = self.resolve_crate(root,
                                                        &dep.name,
                                                        &dep.name,
                                                        Some(&dep.hash),
                                                        span,
                                                        PathKind::Dependency,
                                                        dep.explicitly_linked);
            (dep.cnum, local_cnum)
        }).collect();
        let max_cnum = map.values().cloned().max().unwrap_or(0);
        // we map 0 and all other holes in the map to our parent crate. The "additional"
        // self-dependencies should be harmless.
        (0..max_cnum+1).map(|cnum| map.get(&cnum).cloned().unwrap_or(krate)).collect()
    }
fn resolve_crate_deps ( & mut self , root : & Option < CratePaths > , cdata : & [ u8 ] , krate : ast :: CrateNum , span : Span ) -> cstore :: CrateNumMap { debug ! ( " " ) ; // The map from crate numbers in the crate we're resolving to local crate // numbers let map : FnvHashMap < _ , _ > = decoder :: get_crate_deps ( cdata ) . iter ( ) . map ( | dep | { debug ! ( " " dep name dep hash ) ; let ( local_cnum , _ , _ ) = self . resolve_crate ( root , & dep . name , & dep . name , Some ( & dep . hash ) , span , PathKind :: Dependency , dep . explicitly_linked ) ; ( dep . cnum , local_cnum ) } ) . collect ( ) ; let max_cnum = map . values ( ) . cloned ( ) . max ( ) . unwrap_or ( 0 ) ; // we map 0 and all other holes in the map to our parent crate. The "additional" // self-dependencies should be harmless. ( 0 .. max_cnum + 1 ) . map ( | cnum | map . get ( & cnum ) . cloned ( ) . unwrap_or ( krate ) ) . collect ( ) }
Go through the crate metadata and load any crates that it references
Go through the crate metadata and load any crates that it references
&mut self
root
&Option<CratePaths>
cdata
&[u8]
krate
ast::CrateNum
span
Span
&mut self
root
&Option<CratePaths>
cdata
&[u8]
krate
ast::CrateNum
span
Span