Skip to content

Commit

Permalink
Code cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
adriantombu committed Aug 25, 2022
1 parent bf7ce6a commit d0401f7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
12 changes: 6 additions & 6 deletions compiler/rustc_codegen_ssa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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,
});
}

Expand All @@ -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,
});
}

Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_driver/src/session_diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ pub(crate) struct RLinkEmptyVersionNumber;
#[diag(driver::rlink_encoding_version_mismatch)]
pub(crate) struct RLinkEncodingVersionMismatch {
pub version_array: String,
pub rlink_version: String,
pub rlink_version: u32,
}

#[derive(SessionDiagnostic)]
#[diag(driver::rlink_rustc_version_mismatch)]
pub(crate) struct RLinkRustcVersionMismatch {
pub(crate) struct RLinkRustcVersionMismatch<'a> {
pub rustc_version: String,
pub current_version: String,
pub current_version: &'a str,
}

#[derive(SessionDiagnostic)]
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ decl_derive!(
decl_derive!(
[SessionSubdiagnostic, attributes(
// struct/variant attributes
diag,
label,
help,
note,
Expand Down

0 comments on commit d0401f7

Please sign in to comment.