File tree Expand file tree Collapse file tree 3 files changed +22
-7
lines changed Expand file tree Collapse file tree 3 files changed +22
-7
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
29
29
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
30
30
refs/tags/homu-tmp: c0221c8897db309a79990367476177b1230bb264
31
31
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32
- refs/heads/stable: 6d2c866e22ad1999d4a16b6b7345e031ef74655c
32
+ refs/heads/stable: c32c7c24860eb6ed65bdec2491ba99b6eb5550b8
33
33
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
34
34
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
35
35
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e
Original file line number Diff line number Diff line change @@ -350,15 +350,30 @@ fn handle_explain(code: &str,
350
350
351
351
fn check_cfg ( sopts : & config:: Options ,
352
352
output : ErrorOutputType ) {
353
- fn is_meta_list ( item : & ast:: MetaItem ) -> bool {
353
+ let mut emitter: Box < Emitter > = match output {
354
+ config:: ErrorOutputType :: HumanReadable ( color_config) => {
355
+ Box :: new ( errors:: emitter:: BasicEmitter :: stderr ( color_config) )
356
+ }
357
+ config:: ErrorOutputType :: Json => Box :: new ( errors:: json:: JsonEmitter :: basic ( ) ) ,
358
+ } ;
359
+
360
+ let mut saw_invalid_predicate = false ;
361
+ for item in sopts. cfg . iter ( ) {
354
362
match item. node {
355
- ast:: MetaItem_ :: MetaList ( ..) => true ,
356
- _ => false ,
363
+ ast:: MetaList ( ref pred, _) => {
364
+ saw_invalid_predicate = true ;
365
+ emitter. emit ( None ,
366
+ & format ! ( "invalid predicate in --cfg command line argument: `{}`" ,
367
+ pred) ,
368
+ None ,
369
+ errors:: Level :: Fatal ) ;
370
+ }
371
+ _ => { } ,
357
372
}
358
373
}
359
374
360
- if sopts . cfg . iter ( ) . any ( |item| is_meta_list ( & * item ) ) {
361
- early_error ( output , "predicates are not allowed in --cfg" ) ;
375
+ if saw_invalid_predicate {
376
+ panic ! ( errors :: FatalError ) ;
362
377
}
363
378
}
364
379
Original file line number Diff line number Diff line change 9
9
// except according to those terms.
10
10
11
11
// compile-flags: --cfg foo(bar)
12
- // error-pattern: predicates are not allowed in --cfg
12
+ // error-pattern: invalid predicate in --cfg command line argument: `foo`
13
13
fn main ( ) { }
You can’t perform that action at this time.
0 commit comments