X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustc%2Fhir%2Fmod.rs;h=563fba52aefca4b13331e6b300fdb891c1adb60b;hb=bc4810d907deef00ea5bd0124272cfcab3975e3c;hp=ee83000c44003a92fb144c5c0da5d9c33260afe7;hpb=d0f8e2913a93573c78cddfd297944cff4eb4c41a;p=rust.git diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index ee83000c440..563fba52aef 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -1436,6 +1436,12 @@ pub struct BareFnTy { pub arg_names: HirVec>, } +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct ExistTy { + pub generics: Generics, + pub bounds: TyParamBounds, +} + #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] /// The different kinds of types recognized by the compiler pub enum Ty_ { @@ -1463,7 +1469,16 @@ pub enum Ty_ { TyTraitObject(HirVec, Lifetime), /// An exsitentially quantified (there exists a type satisfying) `impl /// Bound1 + Bound2 + Bound3` type where `Bound` is a trait or a lifetime. - TyImplTraitExistential(TyParamBounds), + /// + /// The `ExistTy` structure emulates an + /// `abstract type Foo<'a, 'b>: MyTrait<'a, 'b>;`. + /// + /// The `HirVec` is the list of lifetimes applied as parameters + /// to the `abstract type`, e.g. the `'c` and `'d` in `-> Foo<'c, 'd>`. + /// This list is only a list of lifetimes and not type parameters + /// because all in-scope type parameters are captured by `impl Trait`, + /// so they are resolved directly through the parent `Generics`. + TyImplTraitExistential(ExistTy, HirVec), /// An universally quantified (for all types satisfying) `impl /// Bound1 + Bound2 + Bound3` type where `Bound` is a trait or a lifetime. TyImplTraitUniversal(DefId, TyParamBounds),