Skip to content

Commit d575186

Browse files
committed
---
yaml --- r: 274716 b: refs/heads/stable c: c32c7c2 h: refs/heads/master
1 parent 82c27d4 commit d575186

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: c0221c8897db309a79990367476177b1230bb264
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 6d2c866e22ad1999d4a16b6b7345e031ef74655c
32+
refs/heads/stable: c32c7c24860eb6ed65bdec2491ba99b6eb5550b8
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/src/librustc_driver/lib.rs

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -350,15 +350,30 @@ fn handle_explain(code: &str,
350350

351351
fn check_cfg(sopts: &config::Options,
352352
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() {
354362
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+
_ => {},
357372
}
358373
}
359374

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);
362377
}
363378
}
364379

branches/stable/src/test/compile-fail/issue-31495.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
// except according to those terms.
1010

1111
// 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`
1313
fn main() {}

0 commit comments

Comments
 (0)