]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_metadata/schema.rs
rustc: always include elidable lifetimes in HIR types.
[rust.git] / src / librustc_metadata / schema.rs
index 2bd5a9ea59d04274aeb723bc9d5dac88da80e421..4f9f2d23f5d3e775205baee9e4b207e5c7aacf7f 100644 (file)
@@ -27,6 +27,8 @@
 
 use std::marker::PhantomData;
 
+use rustc_i128::u128;
+
 pub fn rustc_version() -> String {
     format!("rustc {}",
             option_env!("CFG_VERSION").unwrap_or("unknown version"))
@@ -211,7 +213,7 @@ pub struct Entry<'tcx> {
     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>>>,
@@ -245,6 +247,19 @@ pub enum EntryKind<'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>,
@@ -264,7 +279,7 @@ pub struct FnData {
 #[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.