mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-21 19:33:16 +00:00
Restore --crate-type=metadata as an alias for --crate-type=rlib,--emit=metadata + a warning
This commit is contained in:
parent
71f161c887
commit
9c89166611
@ -1296,7 +1296,7 @@ pub fn build_session_options_and_crate_config(matches: &getopts::Matches)
|
||||
};
|
||||
|
||||
let unparsed_crate_types = matches.opt_strs("crate-type");
|
||||
let crate_types = parse_crate_types_from_list(unparsed_crate_types)
|
||||
let (crate_types, emit_metadata) = parse_crate_types_from_list(unparsed_crate_types)
|
||||
.unwrap_or_else(|e| early_error(error_format, &e[..]));
|
||||
|
||||
let mut lint_opts = vec![];
|
||||
@ -1343,7 +1343,9 @@ pub fn build_session_options_and_crate_config(matches: &getopts::Matches)
|
||||
}
|
||||
}
|
||||
};
|
||||
if output_types.is_empty() {
|
||||
if emit_metadata {
|
||||
output_types.insert(OutputType::Metadata, None);
|
||||
} else if output_types.is_empty() {
|
||||
output_types.insert(OutputType::Exe, None);
|
||||
}
|
||||
|
||||
@ -1545,8 +1547,10 @@ pub fn build_session_options_and_crate_config(matches: &getopts::Matches)
|
||||
cfg)
|
||||
}
|
||||
|
||||
pub fn parse_crate_types_from_list(list_list: Vec<String>) -> Result<Vec<CrateType>, String> {
|
||||
pub fn parse_crate_types_from_list(list_list: Vec<String>)
|
||||
-> Result<(Vec<CrateType>, bool), String> {
|
||||
let mut crate_types: Vec<CrateType> = Vec::new();
|
||||
let mut emit_metadata = false;
|
||||
for unparsed_crate_type in &list_list {
|
||||
for part in unparsed_crate_type.split(',') {
|
||||
let new_part = match part {
|
||||
@ -1557,6 +1561,13 @@ pub fn parse_crate_types_from_list(list_list: Vec<String>) -> Result<Vec<CrateTy
|
||||
"cdylib" => CrateTypeCdylib,
|
||||
"bin" => CrateTypeExecutable,
|
||||
"proc-macro" => CrateTypeProcMacro,
|
||||
// FIXME(#38640) remove this when Cargo is fixed.
|
||||
"metadata" => {
|
||||
early_warn(ErrorOutputType::default(), "--crate-type=metadata is deprecated, \
|
||||
prefer --emit=metadata");
|
||||
emit_metadata = true;
|
||||
CrateTypeRlib
|
||||
}
|
||||
_ => {
|
||||
return Err(format!("unknown crate type: `{}`",
|
||||
part));
|
||||
@ -1568,7 +1579,7 @@ pub fn parse_crate_types_from_list(list_list: Vec<String>) -> Result<Vec<CrateTy
|
||||
}
|
||||
}
|
||||
|
||||
return Ok(crate_types);
|
||||
return Ok((crate_types, emit_metadata));
|
||||
}
|
||||
|
||||
pub mod nightly_options {
|
||||
|
Loading…
Reference in New Issue
Block a user