[−][src]Struct rustc_middle::ty::GeneratorSubsts
Similar to ClosureSubsts; see the above documentation for more.
Fields
substs: SubstsRef<'tcx>Implementations
impl<'tcx> GeneratorSubsts<'tcx>[src]
pub fn new(
tcx: TyCtxt<'tcx>,
parts: GeneratorSubstsParts<'tcx, Ty<'tcx>>
) -> GeneratorSubsts<'tcx>[src]
tcx: TyCtxt<'tcx>,
parts: GeneratorSubstsParts<'tcx, Ty<'tcx>>
) -> GeneratorSubsts<'tcx>
Construct GeneratorSubsts from GeneratorSubstsParts, containing Substs
for the generator parent, alongside additional generator-specific components.
pub(in ty::sty) fn split(
self
) -> GeneratorSubstsParts<'tcx, GenericArg<'tcx>>[src]
self
) -> GeneratorSubstsParts<'tcx, GenericArg<'tcx>>
Divides the generator substs into their respective components.
The ordering assumed here must match that used by GeneratorSubsts::new above.
pub fn is_valid(self) -> bool[src]
Returns true only if enough of the synthetic types are known to
allow using all of the methods on GeneratorSubsts without panicking.
Used primarily by ty::print::pretty to be able to handle generator
types that haven't had their synthetic types substituted in.
pub fn parent_substs(self) -> &'tcx [GenericArg<'tcx>][src]
Returns the substitutions of the generator's parent.
pub fn witness(self) -> Ty<'tcx>[src]
This describes the types that can be contained in a generator. It will be a type variable initially and unified in the last stages of typeck of a body. It contains a tuple of all the types that could end up on a generator frame. The state transformation MIR pass may only produce layouts which mention types in this tuple. Upvars are not counted here.
pub fn upvar_tys(self) -> impl Iterator<Item = Ty<'tcx>> + 'tcx[src]
Returns an iterator over the list of types of captured paths by the generator. In case there was a type error in figuring out the types of the captured path, an empty iterator is returned.
pub fn tupled_upvars_ty(self) -> Ty<'tcx>[src]
Returns the tuple type representing the upvars for this generator.
pub fn resume_ty(self) -> Ty<'tcx>[src]
Returns the type representing the resume type of the generator.
pub fn yield_ty(self) -> Ty<'tcx>[src]
Returns the type representing the yield type of the generator.
pub fn return_ty(self) -> Ty<'tcx>[src]
Returns the type representing the return type of the generator.
pub fn poly_sig(self) -> PolyGenSig<'tcx>[src]
Returns the "generator signature", which consists of its yield and return types.
N.B., some bits of the code prefers to see this wrapped in a binder, but it never contains bound regions. Probably this function should be removed.
pub fn sig(self) -> GenSig<'tcx>[src]
Returns the "generator signature", which consists of its resume, yield and return types.
impl<'tcx> GeneratorSubsts<'tcx>[src]
pub const UNRESUMED: usize[src]
Generator has not been resumed yet.
pub const RETURNED: usize[src]
Generator has returned or is completed.
pub const POISONED: usize[src]
Generator has been poisoned.
pub(in ty::sty) const UNRESUMED_NAME: &'static str[src]
pub(in ty::sty) const RETURNED_NAME: &'static str[src]
pub(in ty::sty) const POISONED_NAME: &'static str[src]
pub fn variant_range(
&self,
def_id: DefId,
tcx: TyCtxt<'tcx>
) -> Range<VariantIdx>[src]
&self,
def_id: DefId,
tcx: TyCtxt<'tcx>
) -> Range<VariantIdx>
The valid variant indices of this generator.
pub fn discriminant_for_variant(
&self,
def_id: DefId,
tcx: TyCtxt<'tcx>,
variant_index: VariantIdx
) -> Discr<'tcx>[src]
&self,
def_id: DefId,
tcx: TyCtxt<'tcx>,
variant_index: VariantIdx
) -> Discr<'tcx>
The discriminant for the given variant. Panics if the variant_index is
out of range.
pub fn discriminants(
self,
def_id: DefId,
tcx: TyCtxt<'tcx>
) -> impl Iterator<Item = (VariantIdx, Discr<'tcx>)> + Captures<'tcx>[src]
self,
def_id: DefId,
tcx: TyCtxt<'tcx>
) -> impl Iterator<Item = (VariantIdx, Discr<'tcx>)> + Captures<'tcx>
The set of all discriminants for the generator, enumerated with their variant indices.
pub fn variant_name(v: VariantIdx) -> Cow<'static, str>[src]
Calls f with a reference to the name of the enumerator for the given
variant v.
pub fn discr_ty(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx>[src]
The type of the state discriminant used in the generator type.
pub fn state_tys(
self,
def_id: DefId,
tcx: TyCtxt<'tcx>
) -> impl Iterator<Item = impl Iterator<Item = Ty<'tcx>> + Captures<'tcx>>[src]
self,
def_id: DefId,
tcx: TyCtxt<'tcx>
) -> impl Iterator<Item = impl Iterator<Item = Ty<'tcx>> + Captures<'tcx>>
This returns the types of the MIR locals which had to be stored across suspension points. It is calculated in rustc_mir::transform::generator::StateTransform. All the types here must be in the tuple in GeneratorInterior.
The locals are grouped by their variant number. Note that some locals may be repeated in multiple variants.
pub fn prefix_tys(self) -> impl Iterator<Item = Ty<'tcx>>[src]
This is the types of the fields of a generator which are not stored in a variant.
Trait Implementations
impl<'tcx> Clone for GeneratorSubsts<'tcx>[src]
pub fn clone(&self) -> GeneratorSubsts<'tcx>[src]
pub fn clone_from(&mut self, source: &Self)1.0.0[src]
impl<'tcx> Copy for GeneratorSubsts<'tcx>[src]
impl<'tcx> Debug for GeneratorSubsts<'tcx>[src]
impl<'a, 'tcx> Lift<'tcx> for GeneratorSubsts<'a>[src]
type Lifted = GeneratorSubsts<'tcx>
pub fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted>[src]
impl<'tcx> Relate<'tcx> for GeneratorSubsts<'tcx>[src]
pub fn relate<R: TypeRelation<'tcx>>(
relation: &mut R,
a: GeneratorSubsts<'tcx>,
b: GeneratorSubsts<'tcx>
) -> RelateResult<'tcx, GeneratorSubsts<'tcx>>[src]
relation: &mut R,
a: GeneratorSubsts<'tcx>,
b: GeneratorSubsts<'tcx>
) -> RelateResult<'tcx, GeneratorSubsts<'tcx>>
impl<'tcx> TypeFoldable<'tcx> for GeneratorSubsts<'tcx>[src]
pub fn super_fold_with<__F: TypeFolder<'tcx>>(self, __folder: &mut __F) -> Self[src]
pub fn super_visit_with<__F: TypeVisitor<'tcx>>(
&self,
__folder: &mut __F
) -> ControlFlow<__F::BreakTy>[src]
&self,
__folder: &mut __F
) -> ControlFlow<__F::BreakTy>
pub fn fold_with<F: TypeFolder<'tcx>>(self, folder: &mut F) -> Self[src]
pub fn visit_with<V: TypeVisitor<'tcx>>(
&self,
visitor: &mut V
) -> ControlFlow<V::BreakTy>[src]
&self,
visitor: &mut V
) -> ControlFlow<V::BreakTy>
pub fn has_vars_bound_at_or_above(&self, binder: DebruijnIndex) -> bool[src]
pub fn has_vars_bound_above(&self, binder: DebruijnIndex) -> bool[src]
pub fn has_escaping_bound_vars(&self) -> bool[src]
pub fn has_type_flags(&self, flags: TypeFlags) -> bool[src]
pub fn has_projections(&self) -> bool[src]
pub fn has_opaque_types(&self) -> bool[src]
pub fn references_error(&self) -> bool[src]
pub fn has_param_types_or_consts(&self) -> bool[src]
pub fn has_infer_regions(&self) -> bool[src]
pub fn has_infer_types(&self) -> bool[src]
pub fn has_infer_types_or_consts(&self) -> bool[src]
pub fn needs_infer(&self) -> bool[src]
pub fn has_placeholders(&self) -> bool[src]
pub fn needs_subst(&self) -> bool[src]
pub fn has_free_regions(&self) -> bool[src]
pub fn has_erased_regions(&self) -> bool[src]
pub fn has_erasable_regions(&self) -> bool[src]
pub fn is_global(&self) -> bool[src]
pub fn has_late_bound_regions(&self) -> bool[src]
pub fn still_further_specializable(&self) -> bool[src]
Auto Trait Implementations
impl<'tcx> !RefUnwindSafe for GeneratorSubsts<'tcx>
impl<'tcx> !Send for GeneratorSubsts<'tcx>
impl<'tcx> !Sync for GeneratorSubsts<'tcx>
impl<'tcx> Unpin for GeneratorSubsts<'tcx>
impl<'tcx> !UnwindSafe for GeneratorSubsts<'tcx>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<'tcx, T> ArenaAllocatable<'tcx, ()> for T where
T: Copy, [src]
T: Copy,
pub fn allocate_on(Self, &'a Arena<'tcx>) -> &'a mut T[src]
pub fn allocate_from_iter(
&'a Arena<'tcx>,
impl IntoIterator<Item = T>
) -> &'a mut [T][src]
&'a Arena<'tcx>,
impl IntoIterator<Item = T>
) -> &'a mut [T]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<'a, T> Captures<'a> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> MaybeResult<T> for T[src]
type Error = !
pub fn from(Result<T, <T as MaybeResult<T>>::Error>) -> T[src]
pub fn to_result(self) -> Result<T, <T as MaybeResult<T>>::Error>[src]
impl<'tcx, T> Subst<'tcx> for T where
T: TypeFoldable<'tcx>, [src]
T: TypeFoldable<'tcx>,
pub fn subst_spanned(Self, TyCtxt<'tcx>, &[GenericArg<'tcx>], Option<Span>) -> T[src]
pub fn subst(self, tcx: TyCtxt<'tcx>, substs: &[GenericArg<'tcx>]) -> Self[src]
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.