Struct rustc_mir_transform::generator::EnsureGeneratorFieldAssignmentsNeverAlias [−][src]
struct EnsureGeneratorFieldAssignmentsNeverAlias<'a> {
saved_locals: &'a GeneratorSavedLocals,
storage_conflicts: &'a BitMatrix<GeneratorSavedLocal, GeneratorSavedLocal>,
assigned_local: Option<GeneratorSavedLocal>,
}
Expand description
Looks for any assignments between locals (e.g., _4 = _5
) that will both be converted to fields
in the generator state machine but whose storage is not marked as conflicting
Validation needs to happen immediately before TransformVisitor
is invoked, not after.
This condition would arise when the assignment is the last use of _5
but the initial
definition of _4
if we weren’t extra careful to mark all locals used inside a statement as
conflicting. Non-conflicting generator saved locals may be stored at the same location within
the generator state machine, which would result in ill-formed MIR: the left-hand and right-hand
sides of an assignment may not alias. This caused a miscompilation in #73137.
Fields
saved_locals: &'a GeneratorSavedLocals
storage_conflicts: &'a BitMatrix<GeneratorSavedLocal, GeneratorSavedLocal>
assigned_local: Option<GeneratorSavedLocal>
Implementations
Trait Implementations
fn visit_ascribe_user_ty(
&mut self,
place: &Place<'tcx>,
variance: &Variance,
user_ty: &UserTypeProjection,
location: Location
)
fn visit_projection(
&mut self,
place_ref: PlaceRef<'tcx>,
context: PlaceContext,
location: Location
)
fn visit_projection_elem(
&mut self,
local: Local,
proj_base: &[ProjectionElem<Local, &'tcx TyS<'tcx>>],
elem: ProjectionElem<Local, &'tcx TyS<'tcx>>,
context: PlaceContext,
location: Location
)
fn super_projection(
&mut self,
place_ref: PlaceRef<'tcx>,
context: PlaceContext,
location: Location
)
fn super_projection_elem(
&mut self,
_local: Local,
_proj_base: &[ProjectionElem<Local, &'tcx TyS<'tcx>>],
elem: ProjectionElem<Local, &'tcx TyS<'tcx>>,
_context: PlaceContext,
location: Location
)
fn visit_user_type_annotation(
&mut self,
index: UserTypeAnnotationIndex,
ty: &CanonicalUserTypeAnnotation<'tcx>
)
fn super_ascribe_user_ty(
&mut self,
place: &Place<'tcx>,
_variance: &Variance,
user_ty: &UserTypeProjection,
location: Location
)
fn super_user_type_annotation(
&mut self,
_index: UserTypeAnnotationIndex,
ty: &CanonicalUserTypeAnnotation<'tcx>
)
Auto Trait Implementations
impl<'a> RefUnwindSafe for EnsureGeneratorFieldAssignmentsNeverAlias<'a>
impl<'a> Send for EnsureGeneratorFieldAssignmentsNeverAlias<'a>
impl<'a> Sync for EnsureGeneratorFieldAssignmentsNeverAlias<'a>
impl<'a> Unpin for EnsureGeneratorFieldAssignmentsNeverAlias<'a>
impl<'a> UnwindSafe for EnsureGeneratorFieldAssignmentsNeverAlias<'a>
Blanket Implementations
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: 24 bytes