]> 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 74825a5c6e3f676325a2419ee782aca90cead7ef..4f9f2d23f5d3e775205baee9e4b207e5c7aacf7f 100644 (file)
@@ -213,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>>>,
@@ -247,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>,