Auto merge of #37681 - nrc:crate-metadata, r=@alexcrichton

add --crate-type metadata

r? @alexcrichton
This commit is contained in:
bors 2016-11-22 21:54:10 -06:00 committed by GitHub
commit 5196ca8518
25 changed files with 374 additions and 81 deletions

View file

@ -78,18 +78,6 @@ pub enum OutputType {
DepInfo,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ErrorOutputType {
HumanReadable(ColorConfig),
Json,
}
impl Default for ErrorOutputType {
fn default() -> ErrorOutputType {
ErrorOutputType::HumanReadable(ColorConfig::Auto)
}
}
impl OutputType {
fn is_compatible_with_codegen_units_and_single_output_file(&self) -> bool {
match *self {
@ -125,6 +113,18 @@ impl OutputType {
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ErrorOutputType {
HumanReadable(ColorConfig),
Json,
}
impl Default for ErrorOutputType {
fn default() -> ErrorOutputType {
ErrorOutputType::HumanReadable(ColorConfig::Auto)
}
}
// Use tree-based collections to cheaply get a deterministic Hash implementation.
// DO NOT switch BTreeMap out for an unsorted container type! That would break
// dependency tracking for commandline arguments.
@ -483,6 +483,7 @@ pub enum CrateType {
CrateTypeStaticlib,
CrateTypeCdylib,
CrateTypeProcMacro,
CrateTypeMetadata,
}
#[derive(Clone, Hash)]
@ -1147,7 +1148,7 @@ pub fn rustc_short_optgroups() -> Vec<RustcOptGroup> {
assumed.", "[KIND=]NAME"),
opt::multi_s("", "crate-type", "Comma separated list of types of crates
for the compiler to emit",
"[bin|lib|rlib|dylib|cdylib|staticlib]"),
"[bin|lib|rlib|dylib|cdylib|staticlib|metadata]"),
opt::opt_s("", "crate-name", "Specify the name of the crate being built",
"NAME"),
opt::multi_s("", "emit", "Comma separated list of types of output for \
@ -1539,6 +1540,7 @@ pub fn parse_crate_types_from_list(list_list: Vec<String>) -> Result<Vec<CrateTy
"cdylib" => CrateTypeCdylib,
"bin" => CrateTypeExecutable,
"proc-macro" => CrateTypeProcMacro,
"metadata" => CrateTypeMetadata,
_ => {
return Err(format!("unknown crate type: `{}`",
part));
@ -1623,6 +1625,7 @@ impl fmt::Display for CrateType {
CrateTypeStaticlib => "staticlib".fmt(f),
CrateTypeCdylib => "cdylib".fmt(f),
CrateTypeProcMacro => "proc-macro".fmt(f),
CrateTypeMetadata => "metadata".fmt(f),
}
}
}