[−][src]Struct rustc_mir::transform::generator::EnsureGeneratorFieldAssignmentsNeverAlias

pub(in transform::generator) struct EnsureGeneratorFieldAssignmentsNeverAlias<'a> {
    saved_locals: &'a GeneratorSavedLocals,
    storage_conflicts: &'a BitMatrix<GeneratorSavedLocal, GeneratorSavedLocal>,
    assigned_local: Option<GeneratorSavedLocal>,
}

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 GeneratorSavedLocalsstorage_conflicts: &'a BitMatrix<GeneratorSavedLocal, GeneratorSavedLocal>assigned_local: Option<GeneratorSavedLocal>

Implementations

impl<'_> EnsureGeneratorFieldAssignmentsNeverAlias<'_>[src]

pub(in transform::generator) fn saved_local_for_direct_place(
    &self,
    place: Place<'_>
) -> Option<GeneratorSavedLocal>
[src]

pub(in transform::generator) fn check_assigned_place<'tcx>(
    &mut self,
    place: Place<'tcx>,
    f: impl FnOnce(&mut Self)
)
[src]

Trait Implementations

impl<'tcx, '_> Visitor<'tcx> for EnsureGeneratorFieldAssignmentsNeverAlias<'_>[src]

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

impl<T> Any for T where
    T: 'static + ?Sized, 
[src]

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> WithConstness for T[src]