use std::marker::PhantomData;
+use rustc_i128::u128;
+
pub fn rustc_version() -> String {
format!("rustc {}",
option_env!("CFG_VERSION").unwrap_or("unknown version"))
#[derive(RustcEncodable, RustcDecodable)]
pub struct Entry<'tcx> {
pub kind: EntryKind<'tcx>,
- pub visibility: ty::Visibility,
+ pub visibility: Lazy<ty::Visibility>,
pub span: Lazy<Span>,
pub attributes: LazySeq<ast::Attribute>,
pub children: LazySeq<DefIndex>,
pub ty: Option<Lazy<Ty<'tcx>>>,
pub inherent_impls: LazySeq<DefIndex>,
pub variances: LazySeq<ty::Variance>,
- pub generics: Option<Lazy<ty::Generics<'tcx>>>,
+ pub generics: Option<Lazy<Generics<'tcx>>>,
pub predicates: Option<Lazy<ty::GenericPredicates<'tcx>>>,
pub ast: Option<Lazy<astencode::Ast<'tcx>>>,
AssociatedConst(AssociatedContainer),
}
+/// A copy of `ty::Generics` which allows lazy decoding of
+/// `regions` and `types` (e.g. knowing the number of type
+/// and lifetime parameters before `TyCtxt` is created).
+#[derive(RustcEncodable, RustcDecodable)]
+pub struct Generics<'tcx> {
+ pub parent: Option<DefId>,
+ pub parent_regions: u32,
+ pub parent_types: u32,
+ pub regions: LazySeq<ty::RegionParameterDef<'tcx>>,
+ pub types: LazySeq<ty::TypeParameterDef<'tcx>>,
+ pub has_self: bool,
+}
+
#[derive(RustcEncodable, RustcDecodable)]
pub struct ModData {
pub reexports: LazySeq<def::Export>,
#[derive(RustcEncodable, RustcDecodable)]
pub struct VariantData {
pub ctor_kind: CtorKind,
- pub disr: u64,
+ pub disr: u128,
/// If this is a struct's only variant, this
/// is the index of the "struct ctor" item.