Fix deserialization of arenas

This commit is contained in:
Dzmitry Malyshau 2021-08-12 22:48:27 -04:00
parent 0feea58a34
commit 1907a92928
2 changed files with 4 additions and 10 deletions

View File

@ -125,16 +125,13 @@ impl<T> Iterator for Range<T> {
/// The arena can be indexed using the given handle to obtain
/// a reference to the stored item.
#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
#[cfg_attr(
any(feature = "serialize", feature = "deserialize"),
serde(transparent)
)]
#[cfg_attr(feature = "serialize", serde(transparent))]
#[cfg_attr(test, derive(PartialEq))]
pub struct Arena<T> {
/// Values of this arena.
data: Vec<T>,
#[cfg(feature = "span")]
#[cfg_attr(any(feature = "serialize", feature = "deserialize"), serde(skip))]
#[cfg_attr(feature = "serialize", serde(skip))]
span_info: Vec<Span>,
}

View File

@ -4,14 +4,11 @@ use std::ops::{Deref, DerefMut, RangeBounds};
/// A code block is a vector of statements, with maybe a vector of spans.
#[derive(Debug, Clone, Default)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
#[cfg_attr(
any(feature = "serialize", feature = "deserialize"),
serde(transparent)
)]
#[cfg_attr(feature = "serialize", serde(transparent))]
pub struct Block {
body: Vec<Statement>,
#[cfg(feature = "span")]
#[cfg_attr(any(feature = "serialize", feature = "deserialize"), serde(skip))]
#[cfg_attr(feature = "serialize", serde(skip))]
span_info: Vec<Span>,
}