Struct rustc_middle::ty::sty::GeneratorSubsts [−][src]
pub struct GeneratorSubsts<'tcx> {
pub substs: SubstsRef<'tcx>,
}
Expand description
Similar to ClosureSubsts
; see the above documentation for more.
Fields
substs: SubstsRef<'tcx>
Implementations
pub fn new(
tcx: TyCtxt<'tcx>,
parts: GeneratorSubstsParts<'tcx, Ty<'tcx>>
) -> GeneratorSubsts<'tcx>
pub fn new(
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.
Divides the generator substs into their respective components.
The ordering assumed here must match that used by GeneratorSubsts::new
above.
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.
Returns the substitutions of the generator’s parent.
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.
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.
Returns the tuple type representing the upvars for this generator.
Returns the type representing the resume type of the generator.
Returns the type representing the yield type of the generator.
Returns the type representing the return type of the generator.
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.
The valid variant indices of this generator.
pub fn discriminant_for_variant(
&self,
def_id: DefId,
tcx: TyCtxt<'tcx>,
variant_index: VariantIdx
) -> Discr<'tcx>
pub fn discriminant_for_variant(
&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>
pub fn discriminants(
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.
Calls f
with a reference to the name of the enumerator for the given
variant v
.
The type of the state discriminant used in the generator type.
This returns the types of the MIR locals which had to be stored across suspension points. It is calculated in rustc_const_eval::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.
This is the types of the fields of a generator which are not stored in a variant.
Trait Implementations
type Lifted = GeneratorSubsts<'tcx>
fn relate<R: TypeRelation<'tcx>>(
relation: &mut R,
a: GeneratorSubsts<'tcx>,
b: GeneratorSubsts<'tcx>
) -> RelateResult<'tcx, GeneratorSubsts<'tcx>>
fn super_visit_with<__F: TypeVisitor<'tcx>>(
&self,
__folder: &mut __F
) -> ControlFlow<__F::BreakTy>
Returns true
if self
has any late-bound regions that are either
bound by binder
or bound by some binder outside of binder
.
If binder
is ty::INNERMOST
, this indicates whether
there are any late-bound regions that appear free. Read more
Returns true
if this self
has any regions that escape binder
(and
hence are not bound by it). Read more
“Free” regions in this context means that it has any region that is not (a) erased or (b) late-bound. Read more
True if there are any un-erased free regions.
Indicates whether this value definitely references only ‘global’ generic parameters that are the same regardless of what fn we are in. This is used for caching. Read more
Indicates whether this value references only ‘global’ generic parameters that are the same regardless of what fn we are in. This is used for caching. Read more
True if there are any late-bound regions
Indicates whether this value still has parameters/placeholders/inference variables
which could be replaced later, in a way that would change the results of impl
specialization. Read more
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
Mutably borrows from an owned value. Read more
Layout
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 8 bytes