Struct rustc_const_eval::transform::check_consts::resolver::TransferFunction [−][src]
struct TransferFunction<'a, 'mir, 'tcx, Q> {
ccx: &'a ConstCx<'mir, 'tcx>,
state: &'a mut State,
_qualif: PhantomData<Q>,
}Expand description
A Visitor that propagates qualifs between locals. This defines the transfer function of
FlowSensitiveAnalysis.
To account for indirect assignments, data flow conservatively assumes that local becomes qualified immediately after it is borrowed or its address escapes. The borrow must allow for mutation, which includes shared borrows of places with interior mutability. The type of borrowed place must contain the qualif.
Fields
ccx: &'a ConstCx<'mir, 'tcx>state: &'a mut State_qualif: PhantomData<Q>Implementations
fn apply_call_return_effect(
&mut self,
_block: BasicBlock,
return_places: CallReturnPlaces<'_, 'tcx>
)
& only allow mutation if the borrowed place is !Freeze.
This assumes that it is UB to take the address of a struct field whose type is
Freeze, then use pointer arithmetic to derive a pointer to a different field of
that same struct whose type is !Freeze. If we decide that this is not UB, we will
have to check the type of the borrowed local instead of the borrowed place
below. See rust-lang/unsafe-code-guidelines#134.
Trait Implementations
fn visit_ascribe_user_ty(
&mut self,
place: &Place,
variance: &Variance,
user_ty: &UserTypeProjection,
location: Location
)
fn visit_projection(
&mut self,
place_ref: PlaceRef,
context: PlaceContext,
location: Location
)
fn visit_projection_elem(
&mut self,
local: Local,
proj_base: &[ProjectionElem<Local, &TyS>],
elem: ProjectionElem<Local, &TyS>,
context: PlaceContext,
location: Location
)
fn super_projection(
&mut self,
place_ref: PlaceRef,
context: PlaceContext,
location: Location
)
fn super_projection_elem(
&mut self,
_local: Local,
_proj_base: &[ProjectionElem<Local, &TyS>],
elem: ProjectionElem<Local, &TyS>,
_context: PlaceContext,
location: Location
)
fn visit_user_type_annotation(
&mut self,
index: UserTypeAnnotationIndex,
ty: &CanonicalUserTypeAnnotation
)
fn super_ascribe_user_ty(
&mut self,
place: &Place,
_variance: &Variance,
user_ty: &UserTypeProjection,
location: Location
)
fn super_user_type_annotation(
&mut self,
_index: UserTypeAnnotationIndex,
ty: &CanonicalUserTypeAnnotation
)
Auto Trait Implementations
impl<'a, 'mir, 'tcx, Q> !RefUnwindSafe for TransferFunction<Q>
impl<'a, 'mir, 'tcx, Q> !Send for TransferFunction<Q>
impl<'a, 'mir, 'tcx, Q> !Sync for TransferFunction<Q>
impl<'a, 'mir, 'tcx, Q> Unpin for TransferFunction<Q> where
Q: Unpin,
'mir: 'a,
'tcx: 'a,
impl<'a, 'mir, 'tcx, Q> !UnwindSafe for TransferFunction<Q>
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: 16 bytes
