@@ -231,6 +231,8 @@ pub enum ProcMacroExpansionError {
231
231
System ( String ) ,
232
232
}
233
233
234
+ pub type ProcMacroLoadResult = Result < Vec < ProcMacro > , String > ;
235
+
234
236
#[ derive( Debug , Clone ) ]
235
237
pub struct ProcMacro {
236
238
pub name : SmolStr ,
@@ -254,7 +256,7 @@ pub struct CrateData {
254
256
pub potential_cfg_options : CfgOptions ,
255
257
pub env : Env ,
256
258
pub dependencies : Vec < Dependency > ,
257
- pub proc_macro : Vec < ProcMacro > ,
259
+ pub proc_macro : ProcMacroLoadResult ,
258
260
pub origin : CrateOrigin ,
259
261
pub is_proc_macro : bool ,
260
262
}
@@ -300,19 +302,19 @@ impl Dependency {
300
302
impl CrateGraph {
301
303
pub fn add_crate_root (
302
304
& mut self ,
303
- file_id : FileId ,
305
+ root_file_id : FileId ,
304
306
edition : Edition ,
305
307
display_name : Option < CrateDisplayName > ,
306
308
version : Option < String > ,
307
309
cfg_options : CfgOptions ,
308
310
potential_cfg_options : CfgOptions ,
309
311
env : Env ,
310
- proc_macro : Vec < ProcMacro > ,
312
+ proc_macro : ProcMacroLoadResult ,
311
313
is_proc_macro : bool ,
312
314
origin : CrateOrigin ,
313
315
) -> CrateId {
314
316
let data = CrateData {
315
- root_file_id : file_id ,
317
+ root_file_id,
316
318
edition,
317
319
version,
318
320
display_name,
@@ -628,7 +630,7 @@ mod tests {
628
630
CfgOptions :: default ( ) ,
629
631
CfgOptions :: default ( ) ,
630
632
Env :: default ( ) ,
631
- Default :: default ( ) ,
633
+ Ok ( Vec :: new ( ) ) ,
632
634
false ,
633
635
CrateOrigin :: CratesIo { repo : None } ,
634
636
) ;
@@ -640,7 +642,7 @@ mod tests {
640
642
CfgOptions :: default ( ) ,
641
643
CfgOptions :: default ( ) ,
642
644
Env :: default ( ) ,
643
- Default :: default ( ) ,
645
+ Ok ( Vec :: new ( ) ) ,
644
646
false ,
645
647
CrateOrigin :: CratesIo { repo : None } ,
646
648
) ;
@@ -652,7 +654,7 @@ mod tests {
652
654
CfgOptions :: default ( ) ,
653
655
CfgOptions :: default ( ) ,
654
656
Env :: default ( ) ,
655
- Default :: default ( ) ,
657
+ Ok ( Vec :: new ( ) ) ,
656
658
false ,
657
659
CrateOrigin :: CratesIo { repo : None } ,
658
660
) ;
@@ -678,7 +680,7 @@ mod tests {
678
680
CfgOptions :: default ( ) ,
679
681
CfgOptions :: default ( ) ,
680
682
Env :: default ( ) ,
681
- Default :: default ( ) ,
683
+ Ok ( Vec :: new ( ) ) ,
682
684
false ,
683
685
CrateOrigin :: CratesIo { repo : None } ,
684
686
) ;
@@ -690,7 +692,7 @@ mod tests {
690
692
CfgOptions :: default ( ) ,
691
693
CfgOptions :: default ( ) ,
692
694
Env :: default ( ) ,
693
- Default :: default ( ) ,
695
+ Ok ( Vec :: new ( ) ) ,
694
696
false ,
695
697
CrateOrigin :: CratesIo { repo : None } ,
696
698
) ;
@@ -713,7 +715,7 @@ mod tests {
713
715
CfgOptions :: default ( ) ,
714
716
CfgOptions :: default ( ) ,
715
717
Env :: default ( ) ,
716
- Default :: default ( ) ,
718
+ Ok ( Vec :: new ( ) ) ,
717
719
false ,
718
720
CrateOrigin :: CratesIo { repo : None } ,
719
721
) ;
@@ -725,7 +727,7 @@ mod tests {
725
727
CfgOptions :: default ( ) ,
726
728
CfgOptions :: default ( ) ,
727
729
Env :: default ( ) ,
728
- Default :: default ( ) ,
730
+ Ok ( Vec :: new ( ) ) ,
729
731
false ,
730
732
CrateOrigin :: CratesIo { repo : None } ,
731
733
) ;
@@ -737,7 +739,7 @@ mod tests {
737
739
CfgOptions :: default ( ) ,
738
740
CfgOptions :: default ( ) ,
739
741
Env :: default ( ) ,
740
- Default :: default ( ) ,
742
+ Ok ( Vec :: new ( ) ) ,
741
743
false ,
742
744
CrateOrigin :: CratesIo { repo : None } ,
743
745
) ;
@@ -760,7 +762,7 @@ mod tests {
760
762
CfgOptions :: default ( ) ,
761
763
CfgOptions :: default ( ) ,
762
764
Env :: default ( ) ,
763
- Default :: default ( ) ,
765
+ Ok ( Vec :: new ( ) ) ,
764
766
false ,
765
767
CrateOrigin :: CratesIo { repo : None } ,
766
768
) ;
@@ -772,7 +774,7 @@ mod tests {
772
774
CfgOptions :: default ( ) ,
773
775
CfgOptions :: default ( ) ,
774
776
Env :: default ( ) ,
775
- Default :: default ( ) ,
777
+ Ok ( Vec :: new ( ) ) ,
776
778
false ,
777
779
CrateOrigin :: CratesIo { repo : None } ,
778
780
) ;
0 commit comments