Skip to content

Commit

Permalink
Hide gated cfg attributes from the output of --print cfg
Browse files Browse the repository at this point in the history
Gated cfg attributes are not available on the stable and beta release
channels, therefore they should not be presented to users of those
channels in order to avoid confusion.
  • Loading branch information
ranma42 committed Mar 3, 2016
1 parent c984cbd commit 4e46eee
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/librustc_driver/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ use syntax::errors;
use syntax::errors::emitter::Emitter;
use syntax::diagnostics;
use syntax::parse::token;
use syntax::feature_gate::UnstableFeatures;
use syntax::feature_gate::{GatedCfg, UnstableFeatures};

#[cfg(test)]
pub mod test;
Expand Down Expand Up @@ -567,7 +567,16 @@ impl RustcDefaultCalls {
PrintRequest::Cfg => {
let mut cfg = config::build_configuration(&sess);
target_features::add_configuration(&mut cfg, &sess);

let allow_unstable_cfg = match get_unstable_features_setting() {
UnstableFeatures::Disallow => false,
_ => true,
};

for cfg in cfg {
if !allow_unstable_cfg && GatedCfg::gate(&*cfg).is_some() {
continue;
}
match cfg.node {
ast::MetaItemKind::Word(ref word) => println!("{}", word),
ast::MetaItemKind::NameValue(ref name, ref value) => {
Expand Down

0 comments on commit 4e46eee

Please sign in to comment.