fn build_reduced_graph_for_external_crate_res(&mut self, child: Export<NodeId>) {
        let parent = self.parent_scope.module;
        let Export { ident, res, vis, span } = child;
        let expansion = ExpnId::root(); // FIXME(jseyfried) intercrate hygiene
        // Record primary definitions.
        match res {
            Res::Def(kind @ DefKind::Mod, def_id)
            | Res::Def(kind @ DefKind::Enum, def_id)
            | Res::Def(kind @ DefKind::Trait, def_id) => {
                let module = self.r.new_module(
                    parent,
                    ModuleKind::Def(kind, def_id, ident.name),
                    def_id,
                    expansion,
                    span,
                );
                self.r.define(parent, ident, TypeNS, (module, vis, span, expansion));
            }
            Res::Def(DefKind::Struct, _)
            | Res::Def(DefKind::Union, _)
            | Res::Def(DefKind::Variant, _)
            | Res::Def(DefKind::TyAlias, _)
            | Res::Def(DefKind::ForeignTy, _)
            | Res::Def(DefKind::OpaqueTy, _)
            | Res::Def(DefKind::TraitAlias, _)
            | Res::Def(DefKind::AssocTy, _)
            | Res::Def(DefKind::AssocOpaqueTy, _)
            | Res::PrimTy(..)
            | Res::ToolMod =>
                self.r.define(parent, ident, TypeNS, (res, vis, span, expansion)),
            Res::Def(DefKind::Fn, _)
            | Res::Def(DefKind::Method, _)
            | Res::Def(DefKind::Static, _)
            | Res::Def(DefKind::Const, _)
            | Res::Def(DefKind::AssocConst, _)
            | Res::Def(DefKind::Ctor(..), _) =>
                self.r.define(parent, ident, ValueNS, (res, vis, span, expansion)),
            Res::Def(DefKind::Macro(..), _)
            | Res::NonMacroAttr(..) =>
                self.r.define(parent, ident, MacroNS, (res, vis, span, expansion)),
            Res::Def(DefKind::TyParam, _) | Res::Def(DefKind::ConstParam, _)
            | Res::Local(..) | Res::SelfTy(..) | Res::SelfCtor(..) | Res::Err =>
                bug!("unexpected resolution: {:?}", res)
        }
        // Record some extra data for better diagnostics.
        let cstore = self.r.cstore();
        match res {
            Res::Def(DefKind::Struct, def_id) | Res::Def(DefKind::Union, def_id) => {
                let field_names = cstore.struct_field_names_untracked(def_id, self.r.session);
                self.insert_field_names(def_id, field_names);
            }
            Res::Def(DefKind::Method, def_id) => {
                if cstore.associated_item_cloned_untracked(def_id).method_has_self_argument {
                    self.r.has_self.insert(def_id);
                }
            }
            Res::Def(DefKind::Ctor(CtorOf::Struct, ..), def_id) => {
                let parent = cstore.def_key(def_id).parent;
                if let Some(struct_def_id) = parent.map(|index| DefId { index, ..def_id }) {
                    self.r.struct_constructors.insert(struct_def_id, (res, vis));
                }
            }
            _ => {}
        }
    }
/// Builds the reduced graph for a single item in an external crate.
Builds the reduced graph for a single item in an external crate.
Builds the reduced graph for a single item in an external crate .
fn build_reduced_graph_for_external_crate_res(&mut self, child: Export<NodeId>) {
        let parent = self.parent_scope.module;
        let Export { ident, res, vis, span } = child;
        let expansion = ExpnId::root(); // FIXME(jseyfried) intercrate hygiene
        // Record primary definitions.
        match res {
            Res::Def(kind @ DefKind::Mod, def_id)
            | Res::Def(kind @ DefKind::Enum, def_id)
            | Res::Def(kind @ DefKind::Trait, def_id) => {
                let module = self.r.new_module(
                    parent,
                    ModuleKind::Def(kind, def_id, ident.name),
                    def_id,
                    expansion,
                    span,
                );
                self.r.define(parent, ident, TypeNS, (module, vis, span, expansion));
            }
            Res::Def(DefKind::Struct, _)
            | Res::Def(DefKind::Union, _)
            | Res::Def(DefKind::Variant, _)
            | Res::Def(DefKind::TyAlias, _)
            | Res::Def(DefKind::ForeignTy, _)
            | Res::Def(DefKind::OpaqueTy, _)
            | Res::Def(DefKind::TraitAlias, _)
            | Res::Def(DefKind::AssocTy, _)
            | Res::Def(DefKind::AssocOpaqueTy, _)
            | Res::PrimTy(..)
            | Res::ToolMod =>
                self.r.define(parent, ident, TypeNS, (res, vis, span, expansion)),
            Res::Def(DefKind::Fn, _)
            | Res::Def(DefKind::Method, _)
            | Res::Def(DefKind::Static, _)
            | Res::Def(DefKind::Const, _)
            | Res::Def(DefKind::AssocConst, _)
            | Res::Def(DefKind::Ctor(..), _) =>
                self.r.define(parent, ident, ValueNS, (res, vis, span, expansion)),
            Res::Def(DefKind::Macro(..), _)
            | Res::NonMacroAttr(..) =>
                self.r.define(parent, ident, MacroNS, (res, vis, span, expansion)),
            Res::Def(DefKind::TyParam, _) | Res::Def(DefKind::ConstParam, _)
            | Res::Local(..) | Res::SelfTy(..) | Res::SelfCtor(..) | Res::Err =>
                bug!("unexpected resolution: {:?}", res)
        }
        // Record some extra data for better diagnostics.
        let cstore = self.r.cstore();
        match res {
            Res::Def(DefKind::Struct, def_id) | Res::Def(DefKind::Union, def_id) => {
                let field_names = cstore.struct_field_names_untracked(def_id, self.r.session);
                self.insert_field_names(def_id, field_names);
            }
            Res::Def(DefKind::Method, def_id) => {
                if cstore.associated_item_cloned_untracked(def_id).method_has_self_argument {
                    self.r.has_self.insert(def_id);
                }
            }
            Res::Def(DefKind::Ctor(CtorOf::Struct, ..), def_id) => {
                let parent = cstore.def_key(def_id).parent;
                if let Some(struct_def_id) = parent.map(|index| DefId { index, ..def_id }) {
                    self.r.struct_constructors.insert(struct_def_id, (res, vis));
                }
            }
            _ => {}
        }
    }
fn build_reduced_graph_for_external_crate_res ( & mut self , child : Export < NodeId > ) { let parent = self . parent_scope . module ; let Export { ident , res , vis , span } = child ; let expansion = ExpnId :: root ( ) ; // FIXME(jseyfried) intercrate hygiene // Record primary definitions. match res { Res :: Def ( kind @ DefKind :: Mod , def_id ) | Res :: Def ( kind @ DefKind :: Enum , def_id ) | Res :: Def ( kind @ DefKind :: Trait , def_id ) => { let module = self . r . new_module ( parent , ModuleKind :: Def ( kind , def_id , ident . name ) , def_id , expansion , span , ) ; self . r . define ( parent , ident , TypeNS , ( module , vis , span , expansion ) ) ; } Res :: Def ( DefKind :: Struct , _ ) | Res :: Def ( DefKind :: Union , _ ) | Res :: Def ( DefKind :: Variant , _ ) | Res :: Def ( DefKind :: TyAlias , _ ) | Res :: Def ( DefKind :: ForeignTy , _ ) | Res :: Def ( DefKind :: OpaqueTy , _ ) | Res :: Def ( DefKind :: TraitAlias , _ ) | Res :: Def ( DefKind :: AssocTy , _ ) | Res :: Def ( DefKind :: AssocOpaqueTy , _ ) | Res :: PrimTy ( .. ) | Res :: ToolMod => self . r . define ( parent , ident , TypeNS , ( res , vis , span , expansion ) ) , Res :: Def ( DefKind :: Fn , _ ) | Res :: Def ( DefKind :: Method , _ ) | Res :: Def ( DefKind :: Static , _ ) | Res :: Def ( DefKind :: Const , _ ) | Res :: Def ( DefKind :: AssocConst , _ ) | Res :: Def ( DefKind :: Ctor ( .. ) , _ ) => self . r . define ( parent , ident , ValueNS , ( res , vis , span , expansion ) ) , Res :: Def ( DefKind :: Macro ( .. ) , _ ) | Res :: NonMacroAttr ( .. ) => self . r . define ( parent , ident , MacroNS , ( res , vis , span , expansion ) ) , Res :: Def ( DefKind :: TyParam , _ ) | Res :: Def ( DefKind :: ConstParam , _ ) | Res :: Local ( .. ) | Res :: SelfTy ( .. ) | Res :: SelfCtor ( .. ) | Res :: Err => bug ! ( " " res ) } // Record some extra data for better diagnostics. let cstore = self . r . cstore ( ) ; match res { Res :: Def ( DefKind :: Struct , def_id ) | Res :: Def ( DefKind :: Union , def_id ) => { let field_names = cstore . struct_field_names_untracked ( def_id , self . r . session ) ; self . insert_field_names ( def_id , field_names ) ; } Res :: Def ( DefKind :: Method , def_id ) => { if cstore . associated_item_cloned_untracked ( def_id ) . method_has_self_argument { self . r . has_self . insert ( def_id ) ; } } Res :: Def ( DefKind :: Ctor ( CtorOf :: Struct , .. ) , def_id ) => { let parent = cstore . def_key ( def_id ) . parent ; if let Some ( struct_def_id ) = parent . map ( | index | DefId { index , .. def_id } ) { self . r . struct_constructors . insert ( struct_def_id , ( res , vis ) ) ; } } _ => { } } }
Builds the reduced graph for a single item in an external crate.
Builds the reduced graph for a single item in an external crate .
&mut self
child
Export<NodeId>