summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa
diff options
context:
space:
mode:
authorAdrian Tombu <adrian@otso.fr>2022-08-25 19:04:00 +0200
committerAdrian Tombu <adrian@otso.fr>2022-08-25 19:04:00 +0200
commitd0401f7f475a2cad5c81114ff916b766b3cbd9c6 (patch)
treec021e5e2a168103685181f4cdbb8acb3bee13b1f /compiler/rustc_codegen_ssa
parentbf7ce6a1a605d897832783a3d0c830d2466d90be (diff)
downloadrust-d0401f7f475a2cad5c81114ff916b766b3cbd9c6.tar.gz
rust-d0401f7f475a2cad5c81114ff916b766b3cbd9c6.zip
Code cleaning
Diffstat (limited to 'compiler/rustc_codegen_ssa')
-rw-r--r--compiler/rustc_codegen_ssa/src/lib.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_codegen_ssa/src/lib.rs b/compiler/rustc_codegen_ssa/src/lib.rs
index d6fa1a15373..0faf51b062b 100644
--- a/compiler/rustc_codegen_ssa/src/lib.rs
+++ b/compiler/rustc_codegen_ssa/src/lib.rs
@@ -168,11 +168,11 @@ pub struct CodegenResults {
     pub crate_info: CrateInfo,
 }
 
-pub enum CodegenErrors {
+pub enum CodegenErrors<'a> {
     WrongFileType,
     EmptyVersionNumber,
-    EncodingVersionMismatch { version_array: String, rlink_version: String },
-    RustcVersionMismatch { rustc_version: String, current_version: String },
+    EncodingVersionMismatch { version_array: String, rlink_version: u32 },
+    RustcVersionMismatch { rustc_version: String, current_version: &'a str },
 }
 
 pub fn provide(providers: &mut Providers) {
@@ -219,7 +219,7 @@ impl CodegenResults {
         encoder.finish()
     }
 
-    pub fn deserialize_rlink(data: Vec<u8>) -> Result<Self, CodegenErrors> {
+    pub fn deserialize_rlink<'a>(data: Vec<u8>) -> Result<Self, CodegenErrors<'a>> {
         // The Decodable machinery is not used here because it panics if the input data is invalid
         // and because its internal representation may change.
         if !data.starts_with(RLINK_MAGIC) {
@@ -235,7 +235,7 @@ impl CodegenResults {
         if u32::from_be_bytes(version_array) != RLINK_VERSION {
             return Err(CodegenErrors::EncodingVersionMismatch {
                 version_array: String::from_utf8_lossy(&version_array).to_string(),
-                rlink_version: RLINK_VERSION.to_string(),
+                rlink_version: RLINK_VERSION,
             });
         }
 
@@ -245,7 +245,7 @@ impl CodegenResults {
         if rustc_version != current_version {
             return Err(CodegenErrors::RustcVersionMismatch {
                 rustc_version: rustc_version.to_string(),
-                current_version: current_version.to_string(),
+                current_version,
             });
         }