}
}
+#[derive(Copy, Clone, Debug)]
+pub enum BodyOwnerKind {
+ /// Functions and methods.
+ Fn,
+
+ /// Constants and associated constants.
+ Const,
+
+ /// Initializer of a `static` item.
+ Static(Mutability),
+}
+
/// An expression
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash)]
pub struct Expr {
pub arg_names: HirVec<Spanned<Name>>,
}
+#[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_ {
/// A trait object type `Bound1 + Bound2 + Bound3`
/// where `Bound` is a trait or a lifetime.
TyTraitObject(HirVec<PolyTraitRef>, Lifetime),
- /// An `impl Bound1 + Bound2 + Bound3` type
- /// where `Bound` is a trait or a lifetime.
- TyImplTrait(TyParamBounds),
+ /// An exsitentially quantified (there exists a type satisfying) `impl
+ /// Bound1 + Bound2 + Bound3` type where `Bound` is a trait or a lifetime.
+ ///
+ /// The `ExistTy` structure emulates an
+ /// `abstract type Foo<'a, 'b>: MyTrait<'a, 'b>;`.
+ ///
+ /// The `HirVec<Lifetime>` 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<Lifetime>),
+ /// An universally quantified (for all types satisfying) `impl
+ /// Bound1 + Bound2 + Bound3` type where `Bound` is a trait or a lifetime.
+ TyImplTraitUniversal(DefId, TyParamBounds),
/// Unused for now
TyTypeof(BodyId),
/// TyInfer means the type should be inferred instead of it having been
}
/// A free variable referred to in a function.
-#[derive(Copy, Clone, RustcEncodable, RustcDecodable)]
+#[derive(Debug, Copy, Clone, RustcEncodable, RustcDecodable)]
pub struct Freevar {
/// The variable being accessed free.
pub def: Def,