@@ -15,6 +15,8 @@ use syntax::SmolStr;
1515use tt:: token_id:: Subtree ;
1616use vfs:: { file_set:: FileSet , AnchoredPath , FileId , VfsPath } ;
1717
18+ pub type ProcMacros = FxHashMap < CrateId , ProcMacroLoadResult > ;
19+
1820/// Files are grouped into source roots. A source root is a directory on the
1921/// file systems which is watched for changes. Typically it corresponds to a
2022/// Rust crate. Source roots *might* be nested: in this case, a file belongs to
@@ -269,7 +271,6 @@ pub struct CrateData {
269271 pub target_layout : TargetLayoutLoadResult ,
270272 pub env : Env ,
271273 pub dependencies : Vec < Dependency > ,
272- pub proc_macro : ProcMacroLoadResult ,
273274 pub origin : CrateOrigin ,
274275 pub is_proc_macro : bool ,
275276}
@@ -322,7 +323,6 @@ impl CrateGraph {
322323 cfg_options : CfgOptions ,
323324 potential_cfg_options : CfgOptions ,
324325 env : Env ,
325- proc_macro : ProcMacroLoadResult ,
326326 is_proc_macro : bool ,
327327 origin : CrateOrigin ,
328328 target_layout : Result < Arc < str > , Arc < str > > ,
@@ -335,7 +335,6 @@ impl CrateGraph {
335335 cfg_options,
336336 potential_cfg_options,
337337 env,
338- proc_macro,
339338 dependencies : Vec :: new ( ) ,
340339 origin,
341340 target_layout,
@@ -460,7 +459,12 @@ impl CrateGraph {
460459 ///
461460 /// The ids of the crates in the `other` graph are shifted by the return
462461 /// amount.
463- pub fn extend ( & mut self , other : CrateGraph ) -> u32 {
462+ pub fn extend (
463+ & mut self ,
464+ other : CrateGraph ,
465+ proc_macros : & mut ProcMacros ,
466+ other_proc_macros : ProcMacros ,
467+ ) -> u32 {
464468 let start = self . arena . len ( ) as u32 ;
465469 self . arena . extend ( other. arena . into_iter ( ) . map ( |( id, mut data) | {
466470 let new_id = id. shift ( start) ;
@@ -469,6 +473,8 @@ impl CrateGraph {
469473 }
470474 ( new_id, data)
471475 } ) ) ;
476+ proc_macros
477+ . extend ( other_proc_macros. into_iter ( ) . map ( |( id, macros) | ( id. shift ( start) , macros) ) ) ;
472478 start
473479 }
474480
@@ -645,7 +651,6 @@ mod tests {
645651 CfgOptions :: default ( ) ,
646652 CfgOptions :: default ( ) ,
647653 Env :: default ( ) ,
648- Ok ( Vec :: new ( ) ) ,
649654 false ,
650655 CrateOrigin :: CratesIo { repo : None , name : None } ,
651656 Err ( "" . into ( ) ) ,
@@ -658,7 +663,6 @@ mod tests {
658663 CfgOptions :: default ( ) ,
659664 CfgOptions :: default ( ) ,
660665 Env :: default ( ) ,
661- Ok ( Vec :: new ( ) ) ,
662666 false ,
663667 CrateOrigin :: CratesIo { repo : None , name : None } ,
664668 Err ( "" . into ( ) ) ,
@@ -671,7 +675,6 @@ mod tests {
671675 CfgOptions :: default ( ) ,
672676 CfgOptions :: default ( ) ,
673677 Env :: default ( ) ,
674- Ok ( Vec :: new ( ) ) ,
675678 false ,
676679 CrateOrigin :: CratesIo { repo : None , name : None } ,
677680 Err ( "" . into ( ) ) ,
@@ -698,7 +701,6 @@ mod tests {
698701 CfgOptions :: default ( ) ,
699702 CfgOptions :: default ( ) ,
700703 Env :: default ( ) ,
701- Ok ( Vec :: new ( ) ) ,
702704 false ,
703705 CrateOrigin :: CratesIo { repo : None , name : None } ,
704706 Err ( "" . into ( ) ) ,
@@ -711,7 +713,6 @@ mod tests {
711713 CfgOptions :: default ( ) ,
712714 CfgOptions :: default ( ) ,
713715 Env :: default ( ) ,
714- Ok ( Vec :: new ( ) ) ,
715716 false ,
716717 CrateOrigin :: CratesIo { repo : None , name : None } ,
717718 Err ( "" . into ( ) ) ,
@@ -735,7 +736,6 @@ mod tests {
735736 CfgOptions :: default ( ) ,
736737 CfgOptions :: default ( ) ,
737738 Env :: default ( ) ,
738- Ok ( Vec :: new ( ) ) ,
739739 false ,
740740 CrateOrigin :: CratesIo { repo : None , name : None } ,
741741 Err ( "" . into ( ) ) ,
@@ -748,7 +748,6 @@ mod tests {
748748 CfgOptions :: default ( ) ,
749749 CfgOptions :: default ( ) ,
750750 Env :: default ( ) ,
751- Ok ( Vec :: new ( ) ) ,
752751 false ,
753752 CrateOrigin :: CratesIo { repo : None , name : None } ,
754753 Err ( "" . into ( ) ) ,
@@ -761,7 +760,6 @@ mod tests {
761760 CfgOptions :: default ( ) ,
762761 CfgOptions :: default ( ) ,
763762 Env :: default ( ) ,
764- Ok ( Vec :: new ( ) ) ,
765763 false ,
766764 CrateOrigin :: CratesIo { repo : None , name : None } ,
767765 Err ( "" . into ( ) ) ,
@@ -785,7 +783,6 @@ mod tests {
785783 CfgOptions :: default ( ) ,
786784 CfgOptions :: default ( ) ,
787785 Env :: default ( ) ,
788- Ok ( Vec :: new ( ) ) ,
789786 false ,
790787 CrateOrigin :: CratesIo { repo : None , name : None } ,
791788 Err ( "" . into ( ) ) ,
@@ -798,7 +795,6 @@ mod tests {
798795 CfgOptions :: default ( ) ,
799796 CfgOptions :: default ( ) ,
800797 Env :: default ( ) ,
801- Ok ( Vec :: new ( ) ) ,
802798 false ,
803799 CrateOrigin :: CratesIo { repo : None , name : None } ,
804800 Err ( "" . into ( ) ) ,
0 commit comments