Skip to content

Commit d0401f7

Browse files
committed
Code cleaning
1 parent bf7ce6a commit d0401f7

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

compiler/rustc_codegen_ssa/src/lib.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,11 @@ pub struct CodegenResults {
168168
pub crate_info: CrateInfo,
169169
}
170170

171-
pub enum CodegenErrors {
171+
pub enum CodegenErrors<'a> {
172172
WrongFileType,
173173
EmptyVersionNumber,
174-
EncodingVersionMismatch { version_array: String, rlink_version: String },
175-
RustcVersionMismatch { rustc_version: String, current_version: String },
174+
EncodingVersionMismatch { version_array: String, rlink_version: u32 },
175+
RustcVersionMismatch { rustc_version: String, current_version: &'a str },
176176
}
177177

178178
pub fn provide(providers: &mut Providers) {
@@ -219,7 +219,7 @@ impl CodegenResults {
219219
encoder.finish()
220220
}
221221

222-
pub fn deserialize_rlink(data: Vec<u8>) -> Result<Self, CodegenErrors> {
222+
pub fn deserialize_rlink<'a>(data: Vec<u8>) -> Result<Self, CodegenErrors<'a>> {
223223
// The Decodable machinery is not used here because it panics if the input data is invalid
224224
// and because its internal representation may change.
225225
if !data.starts_with(RLINK_MAGIC) {
@@ -235,7 +235,7 @@ impl CodegenResults {
235235
if u32::from_be_bytes(version_array) != RLINK_VERSION {
236236
return Err(CodegenErrors::EncodingVersionMismatch {
237237
version_array: String::from_utf8_lossy(&version_array).to_string(),
238-
rlink_version: RLINK_VERSION.to_string(),
238+
rlink_version: RLINK_VERSION,
239239
});
240240
}
241241

@@ -245,7 +245,7 @@ impl CodegenResults {
245245
if rustc_version != current_version {
246246
return Err(CodegenErrors::RustcVersionMismatch {
247247
rustc_version: rustc_version.to_string(),
248-
current_version: current_version.to_string(),
248+
current_version,
249249
});
250250
}
251251

compiler/rustc_driver/src/session_diagnostics.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ pub(crate) struct RLinkEmptyVersionNumber;
1818
#[diag(driver::rlink_encoding_version_mismatch)]
1919
pub(crate) struct RLinkEncodingVersionMismatch {
2020
pub version_array: String,
21-
pub rlink_version: String,
21+
pub rlink_version: u32,
2222
}
2323

2424
#[derive(SessionDiagnostic)]
2525
#[diag(driver::rlink_rustc_version_mismatch)]
26-
pub(crate) struct RLinkRustcVersionMismatch {
26+
pub(crate) struct RLinkRustcVersionMismatch<'a> {
2727
pub rustc_version: String,
28-
pub current_version: String,
28+
pub current_version: &'a str,
2929
}
3030

3131
#[derive(SessionDiagnostic)]

compiler/rustc_macros/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ decl_derive!(
163163
decl_derive!(
164164
[SessionSubdiagnostic, attributes(
165165
// struct/variant attributes
166-
diag,
167166
label,
168167
help,
169168
note,

0 commit comments

Comments
 (0)