Skip to content

Commit 82c27d4

Browse files
committed
---
yaml --- r: 274715 b: refs/heads/stable c: 6d2c866 h: refs/heads/master i: 274713: 4f5c51d 274711: 1666a47
1 parent 3dd1495 commit 82c27d4

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
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: 4c4bb5ff5c5d660c565d6d79f2204e23b673d39e
32+
refs/heads/stable: 6d2c866e22ad1999d4a16b6b7345e031ef74655c
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: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,24 @@ fn handle_explain(code: &str,
348348
}
349349
}
350350

351+
fn check_cfg(sopts: &config::Options,
352+
output: ErrorOutputType) {
353+
fn is_meta_list(item: &ast::MetaItem) -> bool {
354+
match item.node {
355+
ast::MetaItem_::MetaList(..) => true,
356+
_ => false,
357+
}
358+
}
359+
360+
if sopts.cfg.iter().any(|item| is_meta_list(&*item)) {
361+
early_error(output, "predicates are not allowed in --cfg");
362+
}
363+
}
364+
351365
impl<'a> CompilerCalls<'a> for RustcDefaultCalls {
352366
fn early_callback(&mut self,
353367
matches: &getopts::Matches,
354-
_sopts: &config::Options,
368+
sopts: &config::Options,
355369
descriptions: &diagnostics::registry::Registry,
356370
output: ErrorOutputType)
357371
-> Compilation {
@@ -360,6 +374,7 @@ impl<'a> CompilerCalls<'a> for RustcDefaultCalls {
360374
return Compilation::Stop;
361375
}
362376

377+
check_cfg(sopts, output);
363378
Compilation::Continue
364379
}
365380

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// compile-flags: --cfg foo(bar)
12+
// error-pattern: predicates are not allowed in --cfg
13+
fn main() {}

0 commit comments

Comments
 (0)