@@ -15,6 +15,8 @@ use syntax::SmolStr;
15
15
use tt:: token_id:: Subtree ;
16
16
use vfs:: { file_set:: FileSet , AnchoredPath , FileId , VfsPath } ;
17
17
18
+ pub type ProcMacros = FxHashMap < CrateId , ProcMacroLoadResult > ;
19
+
18
20
/// Files are grouped into source roots. A source root is a directory on the
19
21
/// file systems which is watched for changes. Typically it corresponds to a
20
22
/// Rust crate. Source roots *might* be nested: in this case, a file belongs to
@@ -269,7 +271,6 @@ pub struct CrateData {
269
271
pub target_layout : TargetLayoutLoadResult ,
270
272
pub env : Env ,
271
273
pub dependencies : Vec < Dependency > ,
272
- pub proc_macro : ProcMacroLoadResult ,
273
274
pub origin : CrateOrigin ,
274
275
pub is_proc_macro : bool ,
275
276
}
@@ -322,7 +323,6 @@ impl CrateGraph {
322
323
cfg_options : CfgOptions ,
323
324
potential_cfg_options : CfgOptions ,
324
325
env : Env ,
325
- proc_macro : ProcMacroLoadResult ,
326
326
is_proc_macro : bool ,
327
327
origin : CrateOrigin ,
328
328
target_layout : Result < Arc < str > , Arc < str > > ,
@@ -335,7 +335,6 @@ impl CrateGraph {
335
335
cfg_options,
336
336
potential_cfg_options,
337
337
env,
338
- proc_macro,
339
338
dependencies : Vec :: new ( ) ,
340
339
origin,
341
340
target_layout,
@@ -460,7 +459,12 @@ impl CrateGraph {
460
459
///
461
460
/// The ids of the crates in the `other` graph are shifted by the return
462
461
/// 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 {
464
468
let start = self . arena . len ( ) as u32 ;
465
469
self . arena . extend ( other. arena . into_iter ( ) . map ( |( id, mut data) | {
466
470
let new_id = id. shift ( start) ;
@@ -469,6 +473,8 @@ impl CrateGraph {
469
473
}
470
474
( new_id, data)
471
475
} ) ) ;
476
+ proc_macros
477
+ . extend ( other_proc_macros. into_iter ( ) . map ( |( id, macros) | ( id. shift ( start) , macros) ) ) ;
472
478
start
473
479
}
474
480
@@ -645,7 +651,6 @@ mod tests {
645
651
CfgOptions :: default ( ) ,
646
652
CfgOptions :: default ( ) ,
647
653
Env :: default ( ) ,
648
- Ok ( Vec :: new ( ) ) ,
649
654
false ,
650
655
CrateOrigin :: CratesIo { repo : None , name : None } ,
651
656
Err ( "" . into ( ) ) ,
@@ -658,7 +663,6 @@ mod tests {
658
663
CfgOptions :: default ( ) ,
659
664
CfgOptions :: default ( ) ,
660
665
Env :: default ( ) ,
661
- Ok ( Vec :: new ( ) ) ,
662
666
false ,
663
667
CrateOrigin :: CratesIo { repo : None , name : None } ,
664
668
Err ( "" . into ( ) ) ,
@@ -671,7 +675,6 @@ mod tests {
671
675
CfgOptions :: default ( ) ,
672
676
CfgOptions :: default ( ) ,
673
677
Env :: default ( ) ,
674
- Ok ( Vec :: new ( ) ) ,
675
678
false ,
676
679
CrateOrigin :: CratesIo { repo : None , name : None } ,
677
680
Err ( "" . into ( ) ) ,
@@ -698,7 +701,6 @@ mod tests {
698
701
CfgOptions :: default ( ) ,
699
702
CfgOptions :: default ( ) ,
700
703
Env :: default ( ) ,
701
- Ok ( Vec :: new ( ) ) ,
702
704
false ,
703
705
CrateOrigin :: CratesIo { repo : None , name : None } ,
704
706
Err ( "" . into ( ) ) ,
@@ -711,7 +713,6 @@ mod tests {
711
713
CfgOptions :: default ( ) ,
712
714
CfgOptions :: default ( ) ,
713
715
Env :: default ( ) ,
714
- Ok ( Vec :: new ( ) ) ,
715
716
false ,
716
717
CrateOrigin :: CratesIo { repo : None , name : None } ,
717
718
Err ( "" . into ( ) ) ,
@@ -735,7 +736,6 @@ mod tests {
735
736
CfgOptions :: default ( ) ,
736
737
CfgOptions :: default ( ) ,
737
738
Env :: default ( ) ,
738
- Ok ( Vec :: new ( ) ) ,
739
739
false ,
740
740
CrateOrigin :: CratesIo { repo : None , name : None } ,
741
741
Err ( "" . into ( ) ) ,
@@ -748,7 +748,6 @@ mod tests {
748
748
CfgOptions :: default ( ) ,
749
749
CfgOptions :: default ( ) ,
750
750
Env :: default ( ) ,
751
- Ok ( Vec :: new ( ) ) ,
752
751
false ,
753
752
CrateOrigin :: CratesIo { repo : None , name : None } ,
754
753
Err ( "" . into ( ) ) ,
@@ -761,7 +760,6 @@ mod tests {
761
760
CfgOptions :: default ( ) ,
762
761
CfgOptions :: default ( ) ,
763
762
Env :: default ( ) ,
764
- Ok ( Vec :: new ( ) ) ,
765
763
false ,
766
764
CrateOrigin :: CratesIo { repo : None , name : None } ,
767
765
Err ( "" . into ( ) ) ,
@@ -785,7 +783,6 @@ mod tests {
785
783
CfgOptions :: default ( ) ,
786
784
CfgOptions :: default ( ) ,
787
785
Env :: default ( ) ,
788
- Ok ( Vec :: new ( ) ) ,
789
786
false ,
790
787
CrateOrigin :: CratesIo { repo : None , name : None } ,
791
788
Err ( "" . into ( ) ) ,
@@ -798,7 +795,6 @@ mod tests {
798
795
CfgOptions :: default ( ) ,
799
796
CfgOptions :: default ( ) ,
800
797
Env :: default ( ) ,
801
- Ok ( Vec :: new ( ) ) ,
802
798
false ,
803
799
CrateOrigin :: CratesIo { repo : None , name : None } ,
804
800
Err ( "" . into ( ) ) ,
0 commit comments