use middle::resolve_lifetime::ObjectLifetimeDefault;
use middle::region::CodeExtent;
use mir::Mir;
+use mir::GeneratorLayout;
use traits;
use ty;
use ty::subst::{Subst, Substs};
use hir;
pub use self::sty::{Binder, DebruijnIndex};
-pub use self::sty::{FnSig, PolyFnSig};
+pub use self::sty::{FnSig, GenSig, PolyFnSig, PolyGenSig};
pub use self::sty::{InferTy, ParamTy, ProjectionTy, ExistentialPredicate};
-pub use self::sty::{ClosureSubsts, TypeAndMut};
+pub use self::sty::{ClosureSubsts, GeneratorInterior, TypeAndMut};
pub use self::sty::{TraitRef, TypeVariants, PolyTraitRef};
pub use self::sty::{ExistentialTraitRef, PolyExistentialTraitRef};
pub use self::sty::{ExistentialProjection, PolyExistentialProjection};
const HAS_FREE_REGIONS = 1 << 6,
const HAS_TY_ERR = 1 << 7,
const HAS_PROJECTION = 1 << 8,
+
+ // FIXME: Rename this to the actual property since it's used for generators too
const HAS_TY_CLOSURE = 1 << 9,
// true if there are "names" of types and regions and so forth
let result = match ty.sty {
TyBool | TyChar | TyInt(..) | TyUint(..) | TyFloat(..) |
TyRawPtr(..) | TyRef(..) | TyFnDef(..) | TyFnPtr(_) |
- TyArray(..) | TyClosure(..) | TyNever => {
+ TyArray(..) | TyClosure(..) | TyGenerator(..) | TyNever => {
vec![]
}
hir::ExprBox(..) |
hir::ExprAddrOf(..) |
hir::ExprBinary(..) |
+ hir::ExprYield(..) |
hir::ExprCast(..) => {
false
}
self.trait_def(trait_def_id).has_default_impl
}
+ pub fn generator_layout(self, def_id: DefId) -> &'tcx GeneratorLayout<'tcx> {
+ self.optimized_mir(def_id).generator_layout.as_ref().unwrap()
+ }
+
/// Given the def_id of an impl, return the def_id of the trait it implements.
/// If it implements no trait, return `None`.
pub fn trait_id_of_impl(self, def_id: DefId) -> Option<DefId> {