@@ -24,11 +24,12 @@ use crate::{
2424 proc_macro:: { parse_macro_name_and_helper_attrs, ProcMacroKind } ,
2525 DefMap , MacroSubNs ,
2626 } ,
27+ path:: ImportAlias ,
2728 type_ref:: { TraitRef , TypeBound , TypeRef } ,
2829 visibility:: RawVisibility ,
29- AssocItemId , AstIdWithPath , ConstId , ConstLoc , FunctionId , FunctionLoc , HasModule , ImplId ,
30- Intern , ItemContainerId , ItemLoc , Lookup , Macro2Id , MacroRulesId , ModuleId , ProcMacroId ,
31- StaticId , TraitAliasId , TraitId , TypeAliasId , TypeAliasLoc ,
30+ AssocItemId , AstIdWithPath , ConstId , ConstLoc , ExternCrateId , FunctionId , FunctionLoc ,
31+ HasModule , ImplId , Intern , ItemContainerId , ItemLoc , Lookup , Macro2Id , MacroRulesId , ModuleId ,
32+ ProcMacroId , StaticId , TraitAliasId , TraitId , TypeAliasId , TypeAliasLoc ,
3233} ;
3334
3435#[ derive( Debug , Clone , PartialEq , Eq ) ]
@@ -424,6 +425,7 @@ impl MacroRulesData {
424425 Arc :: new ( MacroRulesData { name : makro. name . clone ( ) , macro_export } )
425426 }
426427}
428+
427429#[ derive( Debug , Clone , PartialEq , Eq ) ]
428430pub struct ProcMacroData {
429431 pub name : Name ,
@@ -460,6 +462,30 @@ impl ProcMacroData {
460462 }
461463}
462464
465+ #[ derive( Debug , Clone , PartialEq , Eq ) ]
466+ pub struct ExternCrateDeclData {
467+ pub name : Name ,
468+ pub alias : Option < ImportAlias > ,
469+ pub visibility : RawVisibility ,
470+ }
471+
472+ impl ExternCrateDeclData {
473+ pub ( crate ) fn extern_crate_decl_data_query (
474+ db : & dyn DefDatabase ,
475+ extern_crate : ExternCrateId ,
476+ ) -> Arc < ExternCrateDeclData > {
477+ let loc = extern_crate. lookup ( db) ;
478+ let item_tree = loc. id . item_tree ( db) ;
479+ let extern_crate = & item_tree[ loc. id . value ] ;
480+
481+ Arc :: new ( Self {
482+ name : extern_crate. name . clone ( ) ,
483+ visibility : item_tree[ extern_crate. visibility ] . clone ( ) ,
484+ alias : extern_crate. alias . clone ( ) ,
485+ } )
486+ }
487+ }
488+
463489#[ derive( Debug , Clone , PartialEq , Eq ) ]
464490pub struct ConstData {
465491 /// `None` for `const _: () = ();`
0 commit comments