Rename rustc_serialize::opaque::Encoder as MemEncoder.
This avoids the name clash with `rustc_serialize::Encoder` (a trait), and allows lots qualifiers to be removed and imports to be simplified (e.g. fewer `as` imports). (This was previously merged as commit 5 in #94732 and then was reverted in #97905 because of a perf regression caused by commit 4 in #94732.)
This commit is contained in:
parent
ca122c7ebb
commit
abe45a9ffa
22 changed files with 124 additions and 141 deletions
|
@ -29,7 +29,8 @@ use rustc_middle::dep_graph::WorkProduct;
|
|||
use rustc_middle::middle::dependency_format::Dependencies;
|
||||
use rustc_middle::middle::exported_symbols::SymbolExportKind;
|
||||
use rustc_middle::ty::query::{ExternProviders, Providers};
|
||||
use rustc_serialize::{opaque, Decodable, Decoder, Encodable, Encoder};
|
||||
use rustc_serialize::opaque::{MemDecoder, MemEncoder};
|
||||
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
|
||||
use rustc_session::config::{CrateType, OutputFilenames, OutputType, RUST_CGU_EXT};
|
||||
use rustc_session::cstore::{self, CrateSource};
|
||||
use rustc_session::utils::NativeLibKind;
|
||||
|
@ -203,7 +204,7 @@ const RUSTC_VERSION: Option<&str> = option_env!("CFG_VERSION");
|
|||
|
||||
impl CodegenResults {
|
||||
pub fn serialize_rlink(codegen_results: &CodegenResults) -> Vec<u8> {
|
||||
let mut encoder = opaque::Encoder::new();
|
||||
let mut encoder = MemEncoder::new();
|
||||
encoder.emit_raw_bytes(RLINK_MAGIC);
|
||||
// `emit_raw_bytes` is used to make sure that the version representation does not depend on
|
||||
// Encoder's inner representation of `u32`.
|
||||
|
@ -230,7 +231,7 @@ impl CodegenResults {
|
|||
return Err(".rlink file was produced with encoding version {version_array}, but the current version is {RLINK_VERSION}".to_string());
|
||||
}
|
||||
|
||||
let mut decoder = opaque::Decoder::new(&data[4..], 0);
|
||||
let mut decoder = MemDecoder::new(&data[4..], 0);
|
||||
let rustc_version = decoder.read_str();
|
||||
let current_version = RUSTC_VERSION.unwrap();
|
||||
if rustc_version != current_version {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue