]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/ty/context.rs
Restrict concrete types to equivalent types
[rust.git] / src / librustc / ty / context.rs
index 881c0d4e6d23938fc2a982be712b2c9f07953763..350dcdf571be37b5467dec91c25b901438cef8bf 100644 (file)
@@ -315,6 +315,17 @@ pub fn remove(&mut self, id: hir::HirId) -> Option<V> {
     }
 }
 
+/// All information necessary to validate and reveal an `impl Trait` or `existential Type`
+#[derive(RustcEncodable, RustcDecodable, Debug)]
+pub struct ResolvedOpaqueTy<'tcx> {
+    /// The revealed type as seen by this function.
+    pub concrete_type: Ty<'tcx>,
+    /// Generic parameters on the opaque type as passed by this function.
+    /// For `existential type Foo<A, B>; fn foo<T, U>() -> Foo<T, U> { .. }` this is `[T, U]`, not
+    /// `[A, B]`
+    pub substs: &'tcx Substs<'tcx>,
+}
+
 #[derive(RustcEncodable, RustcDecodable, Debug)]
 pub struct TypeckTables<'tcx> {
     /// The HirId::owner all ItemLocalIds in this table are relative to.
@@ -417,7 +428,7 @@ pub struct TypeckTables<'tcx> {
 
     /// All the existential types that are restricted to concrete types
     /// by this function
-    pub concrete_existential_types: FxHashMap<DefId, Ty<'tcx>>,
+    pub concrete_existential_types: FxHashMap<DefId, ResolvedOpaqueTy<'tcx>>,
 
     /// Given the closure ID this map provides the list of UpvarIDs used by it.
     /// The upvarID contains the HIR node ID and it also contains the full path