rustc: Implement a new --print cfg flag

This commit is an implementation of the new compiler flags required by [RFC
1361][rfc]. This specifically adds a new `cfg` option to the `--print` flag to
the compiler. This new directive will print the defined `#[cfg]` directives by
the compiler for the target in question.

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1361-cargo-cfg-dependencies.md
This commit is contained in:
Alex Crichton 2016-01-25 11:36:18 -08:00
parent 26105b1a37
commit a1ffe6b6bb
3 changed files with 36 additions and 0 deletions

View file

@ -163,6 +163,7 @@ pub enum PrintRequest {
FileNames,
Sysroot,
CrateName,
Cfg,
}
pub enum Input {
@ -1105,6 +1106,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
"crate-name" => PrintRequest::CrateName,
"file-names" => PrintRequest::FileNames,
"sysroot" => PrintRequest::Sysroot,
"cfg" => PrintRequest::Cfg,
req => {
early_error(error_format, &format!("unknown print request `{}`", req))
}