Add new Deinit
statement kind
This commit is contained in:
parent
d00e77078c
commit
9b6b1a625b
27 changed files with 141 additions and 66 deletions
|
@ -1590,6 +1590,8 @@ pub enum StatementKind<'tcx> {
|
|||
/// Write the discriminant for a variant to the enum Place.
|
||||
SetDiscriminant { place: Box<Place<'tcx>>, variant_index: VariantIdx },
|
||||
|
||||
Deinit(Box<Place<'tcx>>),
|
||||
|
||||
/// Start a live range for the storage of the local.
|
||||
StorageLive(Local),
|
||||
|
||||
|
@ -1739,6 +1741,7 @@ impl Debug for Statement<'_> {
|
|||
SetDiscriminant { ref place, variant_index } => {
|
||||
write!(fmt, "discriminant({:?}) = {:?}", place, variant_index)
|
||||
}
|
||||
Deinit(ref place) => write!(fmt, "Deinit({:?})", place),
|
||||
AscribeUserType(box (ref place, ref c_ty), ref variance) => {
|
||||
write!(fmt, "AscribeUserType({:?}, {:?}, {:?})", place, variance, c_ty)
|
||||
}
|
||||
|
|
|
@ -243,6 +243,7 @@ pub fn statement_kind_name(statement: &Statement<'_>) -> &'static str {
|
|||
Assign(..) => "Assign",
|
||||
FakeRead(..) => "FakeRead",
|
||||
SetDiscriminant { .. } => "SetDiscriminant",
|
||||
Deinit(..) => "Deinit",
|
||||
StorageLive(..) => "StorageLive",
|
||||
StorageDead(..) => "StorageDead",
|
||||
Retag(..) => "Retag",
|
||||
|
|
|
@ -399,6 +399,13 @@ macro_rules! make_mir_visitor {
|
|||
location
|
||||
);
|
||||
}
|
||||
StatementKind::Deinit(place) => {
|
||||
self.visit_place(
|
||||
place,
|
||||
PlaceContext::MutatingUse(MutatingUseContext::Store),
|
||||
location
|
||||
)
|
||||
}
|
||||
StatementKind::StorageLive(local) => {
|
||||
self.visit_local(
|
||||
local,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue