Skip to content

Commit

Permalink
Address revuew comments
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewjasper committed Aug 16, 2020
1 parent 92588e4 commit 0e0b790
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/serialization.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Serialization in Rustc

Rustc has to [serialize] and deserialize various data during compilation.
Specifially:
Specifically:

- "Crate metadata", mainly query outputs, are serialized in a binary
format into `rlib` and `rmeta` files that are output when compiling a library
Expand All @@ -17,7 +17,7 @@ Specifially:

The [`rustc_serialize`] crate defines two traits for types which can be serialized:

```rust
```rust,ignore
pub trait Encodable<S: Encoder> {
fn encode(&self, s: &mut S) -> Result<(), S::Error>;
}
Expand All @@ -35,7 +35,7 @@ usually implemented by [derives]. These generate implementations that forward
deserialization to the fields of the struct or enum. For a struct those impls
look something like this:

```rust
```rust,ingore
# #![feature(rustc_private)]
# extern crate rustc_serialize;
# use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
Expand All @@ -59,7 +59,7 @@ impl<D: Decoder> Decodable<D> for MyStruct {
let int = d.read_struct_field("int", 0, Decodable::decode)?;
let float = d.read_struct_field("float", 1, Decodable::decode)?;
Ok(MyStruct::new(int, float, SyntaxContext::root()))
Ok(MyStruct { int, float })
})
}
}
Expand All @@ -82,7 +82,7 @@ impl<'tcx, D: TyDecoder<'tcx>> Decodable<D> for MyStruct<'tcx> {
}
```

The `TyEncodable` and `TyDecodable` [derive macros](derives) will expand to such
The `TyEncodable` and `TyDecodable` [derive macros][derives] will expand to such
an implementation.

Decoding the actual arena allocated type is harder, because some of the
Expand Down

0 comments on commit 0e0b790

Please sign in to comment.