use std::marker::PhantomData;
use std::num::NonZeroUsize;
+use decoder::DecodeContext;
pub use decoder::{provide, provide_extern};
crate use decoder::{CrateMetadata, CrateNumMap, MetadataBlob};
+use encoder::EncodeContext;
use rustc_span::hygiene::SyntaxContextData;
mod decoder;
}
}
-impl<T: ?Sized + LazyMeta> rustc_serialize::UseSpecializedEncodable for Lazy<T> {}
-impl<T: ?Sized + LazyMeta> rustc_serialize::UseSpecializedDecodable for Lazy<T> {}
-
/// Encoding / decoding state for `Lazy`.
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
enum LazyState {
type SyntaxContextTable = Lazy<Table<u32, Lazy<SyntaxContextData>>>;
type ExpnDataTable = Lazy<Table<u32, Lazy<ExpnData>>>;
-#[derive(RustcEncodable, RustcDecodable)]
+#[derive(MetadataEncodable, MetadataDecodable)]
crate struct CrateRoot<'tcx> {
name: Symbol,
triple: TargetTriple,
symbol_mangling_version: SymbolManglingVersion,
}
-#[derive(RustcEncodable, RustcDecodable)]
+#[derive(Encodable, Decodable)]
crate struct CrateDep {
pub name: Symbol,
pub hash: Svh,
pub extra_filename: String,
}
-#[derive(RustcEncodable, RustcDecodable)]
+#[derive(MetadataEncodable, MetadataDecodable)]
crate struct TraitImpls {
trait_id: (u32, DefIndex),
- impls: Lazy<[DefIndex]>,
+ impls: Lazy<[(DefIndex, Option<ty::fast_reject::SimplifiedType>)]>,
}
/// Define `LazyTables` and `TableBuilders` at the same time.
macro_rules! define_tables {
($($name:ident: Table<DefIndex, $T:ty>),+ $(,)?) => {
- #[derive(RustcEncodable, RustcDecodable)]
+ #[derive(MetadataEncodable, MetadataDecodable)]
crate struct LazyTables<'tcx> {
$($name: Lazy!(Table<DefIndex, $T>)),+
}
super_predicates: Table<DefIndex, Lazy!(ty::GenericPredicates<'tcx>)>,
mir: Table<DefIndex, Lazy!(mir::Body<'tcx>)>,
promoted_mir: Table<DefIndex, Lazy!(IndexVec<mir::Promoted, mir::Body<'tcx>>)>,
- unused_generic_params: Table<DefIndex, Lazy<FiniteBitSet<u64>>>,
+ unused_generic_params: Table<DefIndex, Lazy<FiniteBitSet<u32>>>,
}
-#[derive(Copy, Clone, RustcEncodable, RustcDecodable)]
+#[derive(Copy, Clone, MetadataEncodable, MetadataDecodable)]
enum EntryKind {
AnonConst(mir::ConstQualifs, Lazy<RenderedConst>),
Const(mir::ConstQualifs, Lazy<RenderedConst>),
/// Contains a constant which has been rendered to a String.
/// Used by rustdoc.
-#[derive(RustcEncodable, RustcDecodable)]
+#[derive(Encodable, Decodable)]
struct RenderedConst(String);
-#[derive(RustcEncodable, RustcDecodable)]
+#[derive(MetadataEncodable, MetadataDecodable)]
struct ModData {
reexports: Lazy<[Export<hir::HirId>]>,
expansion: ExpnId,
}
-#[derive(RustcEncodable, RustcDecodable)]
+#[derive(MetadataEncodable, MetadataDecodable)]
struct FnData {
asyncness: hir::IsAsync,
constness: hir::Constness,
param_names: Lazy<[Ident]>,
}
-#[derive(RustcEncodable, RustcDecodable)]
+#[derive(TyEncodable, TyDecodable)]
struct VariantData {
ctor_kind: CtorKind,
discr: ty::VariantDiscr,
is_non_exhaustive: bool,
}
-#[derive(RustcEncodable, RustcDecodable)]
+#[derive(TyEncodable, TyDecodable)]
struct TraitData {
unsafety: hir::Unsafety,
paren_sugar: bool,
specialization_kind: ty::trait_def::TraitSpecializationKind,
}
-#[derive(RustcEncodable, RustcDecodable)]
+#[derive(TyEncodable, TyDecodable)]
struct ImplData {
polarity: ty::ImplPolarity,
defaultness: hir::Defaultness,
/// Describes whether the container of an associated item
/// is a trait or an impl and whether, in a trait, it has
/// a default, or an in impl, whether it's marked "default".
-#[derive(Copy, Clone, RustcEncodable, RustcDecodable)]
+#[derive(Copy, Clone, TyEncodable, TyDecodable)]
enum AssocContainer {
TraitRequired,
TraitWithDefault,
}
}
-#[derive(RustcEncodable, RustcDecodable)]
+#[derive(MetadataEncodable, MetadataDecodable)]
struct AssocFnData {
fn_data: FnData,
container: AssocContainer,
has_self: bool,
}
-#[derive(RustcEncodable, RustcDecodable)]
+#[derive(TyEncodable, TyDecodable)]
struct GeneratorData<'tcx> {
layout: mir::GeneratorLayout<'tcx>,
}