diff options
| author | Andrea Canciani <ranma42@gmail.com> | 2016-03-03 10:06:09 +0100 |
|---|---|---|
| committer | Andrea Canciani <ranma42@gmail.com> | 2016-03-03 10:06:09 +0100 |
| commit | 4e46eee110b739ab415affc8f9b524d6b4be8554 (patch) | |
| tree | f5679c3650247a0c418702b64d100561babc2b6a /src | |
| parent | c984cbd9397562f58d654a639923f16569b393ba (diff) | |
| download | rust-4e46eee110b739ab415affc8f9b524d6b4be8554.tar.gz rust-4e46eee110b739ab415affc8f9b524d6b4be8554.zip | |
Hide gated cfg attributes from the output of `--print cfg`
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_driver/lib.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 0a3ebcb4ca1..da565856a9f 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -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; @@ -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) => { |
