1
Fork 0

Auto merge of #85993 - bjorn3:serde_json, r=wesleywiser

Remove all json handling from rustc_serialize

Json is now handled using serde_json. Where appropriate I have replaced json usage with binary serialization (rmeta files) or manual string formatting (emcc linker arg generation).

This allowed for removing and simplifying a lot of code, which hopefully results in faster serialization/deserialization and faster compiles of rustc itself.

Where sensible we now use serde. Metadata and incr cache serialization keeps using a heavily modified (compared to crates.io) rustc-serialize version that in the future could probably be extended with zero-copy deserialization or other perf tricks that serde can't support due to supporting more than one serialization format.

Note that I had to remove `-Zast-json` and `-Zast-json-noexpand` as the relevant AST types don't implement `serde::Serialize`.

Fixes #40177

See also https://github.com/rust-lang/compiler-team/issues/418
This commit is contained in:
bors 2022-06-03 17:55:02 +00:00
commit 7e9b92cb43
48 changed files with 598 additions and 4230 deletions

View file

@ -315,7 +315,7 @@ impl<Tag> Scalar<Tag> {
ScalarSizeMismatch { target_size: target_size.bytes(), data_size: size.bytes() }
})?),
Scalar::Ptr(ptr, sz) => {
if target_size.bytes() != sz.into() {
if target_size.bytes() != u64::from(sz) {
return Err(ScalarSizeMismatch {
target_size: target_size.bytes(),
data_size: sz.into(),

View file

@ -56,8 +56,8 @@ impl PredecessorCache {
impl<S: serialize::Encoder> serialize::Encodable<S> for PredecessorCache {
#[inline]
fn encode(&self, s: &mut S) -> Result<(), S::Error> {
s.emit_unit()
fn encode(&self, _s: &mut S) -> Result<(), S::Error> {
Ok(())
}
}

View file

@ -56,8 +56,8 @@ impl SwitchSourceCache {
impl<S: serialize::Encoder> serialize::Encodable<S> for SwitchSourceCache {
#[inline]
fn encode(&self, s: &mut S) -> Result<(), S::Error> {
s.emit_unit()
fn encode(&self, _s: &mut S) -> Result<(), S::Error> {
Ok(())
}
}

View file

@ -367,8 +367,8 @@ impl PostorderCache {
impl<S: serialize::Encoder> serialize::Encodable<S> for PostorderCache {
#[inline]
fn encode(&self, s: &mut S) -> Result<(), S::Error> {
s.emit_unit()
fn encode(&self, _s: &mut S) -> Result<(), S::Error> {
Ok(())
}
}