Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to --print cfg #31671

Merged
merged 3 commits into from
Mar 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/librustc/session/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ pub fn rustc_short_optgroups() -> Vec<RustcOptGroup> {
"[asm|llvm-bc|llvm-ir|obj|link|dep-info]"),
opt::multi_s("", "print", "Comma separated list of compiler information to \
print on stdout",
"[crate-name|file-names|sysroot|target-list]"),
"[crate-name|file-names|sysroot|cfg|target-list]"),
opt::flagmulti_s("g", "", "Equivalent to -C debuginfo=2"),
opt::flagmulti_s("O", "", "Equivalent to -C opt-level=2"),
opt::opt_s("o", "", "Write output to <filename>", "FILENAME"),
Expand Down
15 changes: 13 additions & 2 deletions 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 @@ -565,7 +565,18 @@ impl RustcDefaultCalls {
}
}
PrintRequest::Cfg => {
for cfg in config::build_configuration(sess) {
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