11# Serialization in Rustc
22
33Rustc has to [ serialize] and deserialize various data during compilation.
4- Specifially :
4+ Specifically :
55
66- "Crate metadata", mainly query outputs, are serialized in a binary
77 format into ` rlib ` and ` rmeta ` files that are output when compiling a library
@@ -17,7 +17,7 @@ Specifially:
1717
1818The [ ` rustc_serialize ` ] crate defines two traits for types which can be serialized:
1919
20- ``` rust
20+ ``` rust,ignore
2121pub trait Encodable<S: Encoder> {
2222 fn encode(&self, s: &mut S) -> Result<(), S::Error>;
2323}
@@ -35,7 +35,7 @@ usually implemented by [derives]. These generate implementations that forward
3535deserialization to the fields of the struct or enum. For a struct those impls
3636look something like this:
3737
38- ``` rust
38+ ``` rust,ingore
3939# #![feature(rustc_private)]
4040# extern crate rustc_serialize;
4141# use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
@@ -59,7 +59,7 @@ impl<D: Decoder> Decodable<D> for MyStruct {
5959 let int = d.read_struct_field("int", 0, Decodable::decode)?;
6060 let float = d.read_struct_field("float", 1, Decodable::decode)?;
6161
62- Ok (MyStruct :: new ( int , float , SyntaxContext :: root ()) )
62+ Ok(MyStruct { int, float } )
6363 })
6464 }
6565}
@@ -82,7 +82,7 @@ impl<'tcx, D: TyDecoder<'tcx>> Decodable<D> for MyStruct<'tcx> {
8282}
8383```
8484
85- The ` TyEncodable ` and ` TyDecodable ` [ derive macros] ( derives ) will expand to such
85+ The ` TyEncodable ` and ` TyDecodable ` [ derive macros] [ derives ] will expand to such
8686an implementation.
8787
8888Decoding the actual arena allocated type is harder, because some of the
0 commit comments