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.
This commit is contained in:
parent
c984cbd939
commit
4e46eee110
1 changed files with 10 additions and 1 deletions
|
|
@ -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) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue