File tree Expand file tree Collapse file tree 1 file changed +25
-12
lines changed
src/cargo/core/compiler/build_context Expand file tree Collapse file tree 1 file changed +25
-12
lines changed Original file line number Diff line number Diff line change @@ -253,16 +253,29 @@ impl TargetInfo {
253
253
res
254
254
} ;
255
255
256
- let cfg = lines
257
- . map ( |line| Ok ( Cfg :: from_str ( line) ?) )
258
- . filter ( TargetInfo :: not_user_specific_cfg)
259
- . collect :: < CargoResult < Vec < _ > > > ( )
260
- . with_context ( || {
261
- format ! (
262
- "failed to parse the cfg from `rustc --print=cfg`, got:\n {}" ,
263
- output
264
- )
265
- } ) ?;
256
+ let cfg = {
257
+ let mut res = Vec :: new ( ) ;
258
+ loop {
259
+ match lines. next ( ) {
260
+ Some ( line) => {
261
+ let cfg = Cfg :: from_str ( line) . with_context ( || {
262
+ format ! (
263
+ "failed to parse the cfg from `rustc --print=cfg`, got:\n {}" ,
264
+ output
265
+ )
266
+ } ) ?;
267
+ if TargetInfo :: not_user_specific_cfg ( & cfg) {
268
+ res. push ( cfg) ;
269
+ }
270
+ }
271
+ None if res. is_empty ( ) => {
272
+ return error_missing_print_output ( "cfgs" , & process, & output, & error)
273
+ }
274
+ None => break ,
275
+ }
276
+ }
277
+ res
278
+ } ;
266
279
267
280
// recalculate `rustflags` from above now that we have `cfg`
268
281
// information
@@ -315,8 +328,8 @@ impl TargetInfo {
315
328
}
316
329
}
317
330
318
- fn not_user_specific_cfg ( cfg : & CargoResult < Cfg > ) -> bool {
319
- if let Ok ( Cfg :: Name ( cfg_name) ) = cfg {
331
+ fn not_user_specific_cfg ( cfg : & Cfg ) -> bool {
332
+ if let Cfg :: Name ( cfg_name) = cfg {
320
333
// This should also include "debug_assertions", but it causes
321
334
// regressions. Maybe some day in the distant future it can be
322
335
// added (and possibly change the warning to an error).
You can’t perform that action at this time.
0 commit comments