mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-02 15:56:09 +03:00
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:
@@ -94,7 +94,7 @@
|
||||
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 @@ fn print_crate_info(sess: &Session,
|
||||
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) => {
|
||||
|
||||
Reference in New Issue
Block a user