@@ -65,6 +65,10 @@ pub struct CargoConfig {
65
65
/// rustc target
66
66
pub target : Option < String > ,
67
67
68
+ /// Don't load sysroot crates (`std`, `core` & friends). Might be useful
69
+ /// when debugging isolated issues.
70
+ pub no_sysroot : bool ,
71
+
68
72
/// rustc private crate source
69
73
pub rustc_source : Option < AbsPathBuf > ,
70
74
}
@@ -140,27 +144,27 @@ impl PackageData {
140
144
impl CargoWorkspace {
141
145
pub fn from_cargo_metadata (
142
146
cargo_toml : & AbsPath ,
143
- cargo_features : & CargoConfig ,
147
+ config : & CargoConfig ,
144
148
) -> Result < CargoWorkspace > {
145
149
let mut meta = MetadataCommand :: new ( ) ;
146
150
meta. cargo_path ( toolchain:: cargo ( ) ) ;
147
151
meta. manifest_path ( cargo_toml. to_path_buf ( ) ) ;
148
- if cargo_features . all_features {
152
+ if config . all_features {
149
153
meta. features ( CargoOpt :: AllFeatures ) ;
150
154
} else {
151
- if cargo_features . no_default_features {
155
+ if config . no_default_features {
152
156
// FIXME: `NoDefaultFeatures` is mutual exclusive with `SomeFeatures`
153
157
// https://github.com/oli-obk/cargo_metadata/issues/79
154
158
meta. features ( CargoOpt :: NoDefaultFeatures ) ;
155
159
}
156
- if !cargo_features . features . is_empty ( ) {
157
- meta. features ( CargoOpt :: SomeFeatures ( cargo_features . features . clone ( ) ) ) ;
160
+ if !config . features . is_empty ( ) {
161
+ meta. features ( CargoOpt :: SomeFeatures ( config . features . clone ( ) ) ) ;
158
162
}
159
163
}
160
164
if let Some ( parent) = cargo_toml. parent ( ) {
161
165
meta. current_dir ( parent. to_path_buf ( ) ) ;
162
166
}
163
- if let Some ( target) = cargo_features . target . as_ref ( ) {
167
+ if let Some ( target) = config . target . as_ref ( ) {
164
168
meta. other_options ( vec ! [ String :: from( "--filter-platform" ) , target. clone( ) ] ) ;
165
169
}
166
170
let mut meta = meta. exec ( ) . with_context ( || {
@@ -170,8 +174,8 @@ impl CargoWorkspace {
170
174
let mut out_dir_by_id = FxHashMap :: default ( ) ;
171
175
let mut cfgs = FxHashMap :: default ( ) ;
172
176
let mut proc_macro_dylib_paths = FxHashMap :: default ( ) ;
173
- if cargo_features . load_out_dirs_from_check {
174
- let resources = load_extern_resources ( cargo_toml, cargo_features ) ?;
177
+ if config . load_out_dirs_from_check {
178
+ let resources = load_extern_resources ( cargo_toml, config ) ?;
175
179
out_dir_by_id = resources. out_dirs ;
176
180
cfgs = resources. cfgs ;
177
181
proc_macro_dylib_paths = resources. proc_dylib_paths ;
0 commit comments