@@ -27,6 +27,7 @@ pub struct WorkspaceBuilder {
27
27
command_timeout : Option < Duration > ,
28
28
command_no_output_timeout : Option < Duration > ,
29
29
fetch_registry_index_during_builds : bool ,
30
+ fetch_build_std_dependencies : bool ,
30
31
running_inside_docker : bool ,
31
32
fast_init : bool ,
32
33
rustup_profile : String ,
@@ -45,6 +46,7 @@ impl WorkspaceBuilder {
45
46
command_timeout : DEFAULT_COMMAND_TIMEOUT ,
46
47
command_no_output_timeout : DEFAULT_COMMAND_NO_OUTPUT_TIMEOUT ,
47
48
fetch_registry_index_during_builds : true ,
49
+ fetch_build_std_dependencies : false ,
48
50
running_inside_docker : false ,
49
51
fast_init : false ,
50
52
rustup_profile : DEFAULT_RUSTUP_PROFILE . into ( ) ,
@@ -107,6 +109,19 @@ impl WorkspaceBuilder {
107
109
self
108
110
}
109
111
112
+ /// Enable or disable pre-fetching the dependencies for `-Z build-std` when preparing the sandbox (disabled by default).
113
+ ///
114
+ /// When this option is enabled, it is possible to use `-Zbuild-std` inside
115
+ /// the sandbox to build the standard library from source even when
116
+ /// networking is disabled. You will still need to run
117
+ /// `toolchain.add_component("rust-src")` before entering the sandbox.
118
+ #[ cfg( any( feature = "unstable" , doc) ) ]
119
+ #[ cfg_attr( docs_rs, doc( cfg( feature = "unstable" ) ) ) ]
120
+ pub fn fetch_build_std_dependencies ( mut self , enable : bool ) -> Self {
121
+ self . fetch_build_std_dependencies = enable;
122
+ self
123
+ }
124
+
110
125
/// Enable or disable support for running Rustwide itself inside Docker (disabled by default).
111
126
///
112
127
/// When support is enabled Rustwide will try to detect whether it's actually running inside a
@@ -160,6 +175,7 @@ impl WorkspaceBuilder {
160
175
command_timeout : self . command_timeout ,
161
176
command_no_output_timeout : self . command_no_output_timeout ,
162
177
fetch_registry_index_during_builds : self . fetch_registry_index_during_builds ,
178
+ fetch_build_std_dependencies : self . fetch_build_std_dependencies ,
163
179
current_container : None ,
164
180
rustup_profile : self . rustup_profile ,
165
181
} ) ,
@@ -183,6 +199,7 @@ struct WorkspaceInner {
183
199
command_timeout : Option < Duration > ,
184
200
command_no_output_timeout : Option < Duration > ,
185
201
fetch_registry_index_during_builds : bool ,
202
+ fetch_build_std_dependencies : bool ,
186
203
current_container : Option < CurrentContainer > ,
187
204
rustup_profile : String ,
188
205
}
@@ -299,6 +316,10 @@ impl Workspace {
299
316
self . inner . fetch_registry_index_during_builds
300
317
}
301
318
319
+ pub ( crate ) fn fetch_build_std_dependencies ( & self ) -> bool {
320
+ self . inner . fetch_build_std_dependencies
321
+ }
322
+
302
323
pub ( crate ) fn current_container ( & self ) -> Option < & CurrentContainer > {
303
324
self . inner . current_container . as_ref ( )
304
325
}
0 commit comments