summaryrefslogtreecommitdiff
path: root/src/librustc_codegen_utils
diff options
context:
space:
mode:
authorMark Rousskov <mark.simulacrum@gmail.com>2018-07-26 11:13:11 -0600
committerMark Rousskov <mark.simulacrum@gmail.com>2018-08-04 06:53:15 -0600
commit2a9344206be8ecd1cd2106bd93cccf46892fc2e5 (patch)
treec7f24f8ff8b1bbdf361f42b7a1697181a5efcea8 /src/librustc_codegen_utils
parente59e02ef46c360eb6a2e2e30dd7cd10fc71e5e41 (diff)
downloadrust-2a9344206be8ecd1cd2106bd93cccf46892fc2e5.tar.gz
Normalize variants of CrateType to standard style
This is a clippy-breaking change.
Diffstat (limited to 'src/librustc_codegen_utils')
-rw-r--r--src/librustc_codegen_utils/codegen_backend.rs12
-rw-r--r--src/librustc_codegen_utils/link.rs28
2 files changed, 20 insertions, 20 deletions
diff --git a/src/librustc_codegen_utils/codegen_backend.rs b/src/librustc_codegen_utils/codegen_backend.rs
index 3f230dd5d45..7e726f00b0b 100644
--- a/src/librustc_codegen_utils/codegen_backend.rs
+++ b/src/librustc_codegen_utils/codegen_backend.rs
@@ -114,8 +114,7 @@ impl CodegenBackend for MetadataOnlyCodegenBackend {
fn init(&self, sess: &Session) {
for cty in sess.opts.crate_types.iter() {
match *cty {
- CrateType::CrateTypeRlib | CrateType::CrateTypeDylib |
- CrateType::CrateTypeExecutable => {},
+ CrateType::Rlib | CrateType::Dylib | CrateType::Executable => {},
_ => {
sess.parse_sess.span_diagnostic.warn(
&format!("LLVM unsupported, so output type {} is not supported", cty)
@@ -201,13 +200,14 @@ impl CodegenBackend for MetadataOnlyCodegenBackend {
let ongoing_codegen = ongoing_codegen.downcast::<OngoingCodegen>()
.expect("Expected MetadataOnlyCodegenBackend's OngoingCodegen, found Box<dyn Any>");
for &crate_type in sess.opts.crate_types.iter() {
- if crate_type != CrateType::CrateTypeRlib && crate_type != CrateType::CrateTypeDylib {
+ if crate_type != CrateType::Rlib &&
+ crate_type != CrateType::Dylib {
continue;
}
let output_name =
out_filename(sess, crate_type, &outputs, &ongoing_codegen.crate_name.as_str());
let mut compressed = ongoing_codegen.metadata_version.clone();
- let metadata = if crate_type == CrateType::CrateTypeDylib {
+ let metadata = if crate_type == CrateType::Dylib {
DeflateEncoder::new(&mut compressed, Compression::fast())
.write_all(&ongoing_codegen.metadata.raw_data)
.unwrap();
@@ -220,8 +220,8 @@ impl CodegenBackend for MetadataOnlyCodegenBackend {
}
sess.abort_if_errors();
- if !sess.opts.crate_types.contains(&CrateType::CrateTypeRlib)
- && !sess.opts.crate_types.contains(&CrateType::CrateTypeDylib)
+ if !sess.opts.crate_types.contains(&CrateType::Rlib)
+ && !sess.opts.crate_types.contains(&CrateType::Dylib)
{
sess.fatal("Executables are not supported by the metadata-only backend.");
}
diff --git a/src/librustc_codegen_utils/link.rs b/src/librustc_codegen_utils/link.rs
index b33482eb868..73cffdf7d49 100644
--- a/src/librustc_codegen_utils/link.rs
+++ b/src/librustc_codegen_utils/link.rs
@@ -114,24 +114,24 @@ pub fn filename_for_input(sess: &Session,
let libname = format!("{}{}", crate_name, sess.opts.cg.extra_filename);
match crate_type {
- config::CrateTypeRlib => {
+ config::CrateType::Rlib => {
outputs.out_directory.join(&format!("lib{}.rlib", libname))
}
- config::CrateTypeCdylib |
- config::CrateTypeProcMacro |
- config::CrateTypeDylib => {
+ config::CrateType::Cdylib |
+ config::CrateType::ProcMacro |
+ config::CrateType::Dylib => {
let (prefix, suffix) = (&sess.target.target.options.dll_prefix,
&sess.target.target.options.dll_suffix);
outputs.out_directory.join(&format!("{}{}{}", prefix, libname,
suffix))
}
- config::CrateTypeStaticlib => {
+ config::CrateType::Staticlib => {
let (prefix, suffix) = (&sess.target.target.options.staticlib_prefix,
&sess.target.target.options.staticlib_suffix);
outputs.out_directory.join(&format!("{}{}{}", prefix, libname,
suffix))
}
- config::CrateTypeExecutable => {
+ config::CrateType::Executable => {
let suffix = &sess.target.target.options.exe_suffix;
let out_filename = outputs.path(OutputType::Exe);
if suffix.is_empty() {
@@ -148,15 +148,15 @@ pub fn filename_for_input(sess: &Session,
/// Default crate type is used when crate type isn't provided neither
/// through cmd line arguments nor through crate attributes
///
-/// It is CrateTypeExecutable for all platforms but iOS as there is no
+/// It is CrateType::Executable for all platforms but iOS as there is no
/// way to run iOS binaries anyway without jailbreaking and
/// interaction with Rust code through static library is the only
/// option for now
pub fn default_output_for_target(sess: &Session) -> config::CrateType {
if !sess.target.target.options.executables {
- config::CrateTypeStaticlib
+ config::CrateType::Staticlib
} else {
- config::CrateTypeExecutable
+ config::CrateType::Executable
}
}
@@ -164,9 +164,9 @@ pub fn default_output_for_target(sess: &Session) -> config::CrateType {
pub fn invalid_output_for_target(sess: &Session,
crate_type: config::CrateType) -> bool {
match crate_type {
- config::CrateTypeCdylib |
- config::CrateTypeDylib |
- config::CrateTypeProcMacro => {
+ config::CrateType::Cdylib |
+ config::CrateType::Dylib |
+ config::CrateType::ProcMacro => {
if !sess.target.target.options.dynamic_linking {
return true
}
@@ -178,12 +178,12 @@ pub fn invalid_output_for_target(sess: &Session,
}
if sess.target.target.options.only_cdylib {
match crate_type {
- config::CrateTypeProcMacro | config::CrateTypeDylib => return true,
+ config::CrateType::ProcMacro | config::CrateType::Dylib => return true,
_ => {}
}
}
if !sess.target.target.options.executables {
- if crate_type == config::CrateTypeExecutable {
+ if crate_type == config::CrateType::Executable {
return true
}
}