@@ -63,6 +63,8 @@ pub struct ProjectWorkspace {
63
63
pub target_layout : TargetLayoutLoadResult ,
64
64
/// A set of cfg overrides for this workspace.
65
65
pub cfg_overrides : CfgOverrides ,
66
+ /// Additional includes to add for the VFS.
67
+ pub extra_includes : Vec < AbsPathBuf > ,
66
68
}
67
69
68
70
#[ derive( Clone ) ]
@@ -104,7 +106,15 @@ pub enum ProjectWorkspaceKind {
104
106
impl fmt:: Debug for ProjectWorkspace {
105
107
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
106
108
// Make sure this isn't too verbose.
107
- let Self { kind, sysroot, rustc_cfg, toolchain, target_layout, cfg_overrides } = self ;
109
+ let Self {
110
+ kind,
111
+ sysroot,
112
+ rustc_cfg,
113
+ toolchain,
114
+ target_layout,
115
+ cfg_overrides,
116
+ extra_includes,
117
+ } = self ;
108
118
match kind {
109
119
ProjectWorkspaceKind :: Cargo { cargo, error : _, build_scripts, rustc, set_test } => f
110
120
. debug_struct ( "Cargo" )
@@ -117,6 +127,7 @@ impl fmt::Debug for ProjectWorkspace {
117
127
)
118
128
. field ( "n_rustc_cfg" , & rustc_cfg. len ( ) )
119
129
. field ( "n_cfg_overrides" , & cfg_overrides. len ( ) )
130
+ . field ( "n_extra_includes" , & extra_includes. len ( ) )
120
131
. field ( "toolchain" , & toolchain)
121
132
. field ( "data_layout" , & target_layout)
122
133
. field ( "set_test" , set_test)
@@ -130,7 +141,8 @@ impl fmt::Debug for ProjectWorkspace {
130
141
. field ( "n_rustc_cfg" , & rustc_cfg. len ( ) )
131
142
. field ( "toolchain" , & toolchain)
132
143
. field ( "data_layout" , & target_layout)
133
- . field ( "n_cfg_overrides" , & cfg_overrides. len ( ) ) ;
144
+ . field ( "n_cfg_overrides" , & cfg_overrides. len ( ) )
145
+ . field ( "n_extra_includes" , & extra_includes. len ( ) ) ;
134
146
135
147
debug_struct. finish ( )
136
148
}
@@ -144,6 +156,7 @@ impl fmt::Debug for ProjectWorkspace {
144
156
. field ( "toolchain" , & toolchain)
145
157
. field ( "data_layout" , & target_layout)
146
158
. field ( "n_cfg_overrides" , & cfg_overrides. len ( ) )
159
+ . field ( "n_extra_includes" , & extra_includes. len ( ) )
147
160
. field ( "set_test" , set_test)
148
161
. finish ( ) ,
149
162
}
@@ -320,6 +333,7 @@ impl ProjectWorkspace {
320
333
cfg_overrides,
321
334
toolchain,
322
335
target_layout : data_layout. map ( Arc :: from) . map_err ( |it| Arc :: from ( it. to_string ( ) ) ) ,
336
+ extra_includes : config. extra_includes . clone ( ) ,
323
337
} )
324
338
}
325
339
@@ -340,6 +354,7 @@ impl ProjectWorkspace {
340
354
toolchain,
341
355
target_layout : data_layout. map ( Arc :: from) . map_err ( |it| Arc :: from ( it. to_string ( ) ) ) ,
342
356
cfg_overrides : config. cfg_overrides . clone ( ) ,
357
+ extra_includes : config. extra_includes . clone ( ) ,
343
358
}
344
359
}
345
360
@@ -399,6 +414,7 @@ impl ProjectWorkspace {
399
414
toolchain,
400
415
target_layout : data_layout. map ( Arc :: from) . map_err ( |it| Arc :: from ( it. to_string ( ) ) ) ,
401
416
cfg_overrides : config. cfg_overrides . clone ( ) ,
417
+ extra_includes : config. extra_includes . clone ( ) ,
402
418
} )
403
419
}
404
420
@@ -565,7 +581,13 @@ impl ProjectWorkspace {
565
581
566
582
PackageRoot {
567
583
is_local : krate. is_workspace_member ,
568
- include : krate. include . iter ( ) . cloned ( ) . chain ( build_file) . collect ( ) ,
584
+ include : krate
585
+ . include
586
+ . iter ( )
587
+ . cloned ( )
588
+ . chain ( build_file)
589
+ . chain ( self . extra_includes . iter ( ) . cloned ( ) )
590
+ . collect ( ) ,
569
591
exclude : krate. exclude . clone ( ) ,
570
592
}
571
593
} )
@@ -603,6 +625,8 @@ impl ProjectWorkspace {
603
625
604
626
let mut exclude = vec ! [ pkg_root. join( ".git" ) ] ;
605
627
if is_local {
628
+ include. extend ( self . extra_includes . iter ( ) . cloned ( ) ) ;
629
+
606
630
exclude. push ( pkg_root. join ( "target" ) ) ;
607
631
} else {
608
632
exclude. push ( pkg_root. join ( "tests" ) ) ;
@@ -661,6 +685,8 @@ impl ProjectWorkspace {
661
685
662
686
let mut exclude = vec ! [ pkg_root. join( ".git" ) ] ;
663
687
if is_local {
688
+ include. extend ( self . extra_includes . iter ( ) . cloned ( ) ) ;
689
+
664
690
exclude. push ( pkg_root. join ( "target" ) ) ;
665
691
} else {
666
692
exclude. push ( pkg_root. join ( "tests" ) ) ;
0 commit comments