summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_middle/src/mir/visit.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_middle/src/mir/visit.rs')
-rw-r--r--compiler/rustc_middle/src/mir/visit.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/mir/visit.rs b/compiler/rustc_middle/src/mir/visit.rs
index ddcf3711b..b21f50ae5 100644
--- a/compiler/rustc_middle/src/mir/visit.rs
+++ b/compiler/rustc_middle/src/mir/visit.rs
@@ -847,6 +847,17 @@ macro_rules! make_mir_visitor {
PlaceContext::NonUse(NonUseContext::VarDebugInfo),
location
),
+ VarDebugInfoContents::Composite { ty, fragments } => {
+ // FIXME(eddyb) use a better `TyContext` here.
+ self.visit_ty($(& $mutability)? *ty, TyContext::Location(location));
+ for VarDebugInfoFragment { projection: _, contents } in fragments {
+ self.visit_place(
+ contents,
+ PlaceContext::NonUse(NonUseContext::VarDebugInfo),
+ location,
+ );
+ }
+ }
}
}
@@ -1320,6 +1331,15 @@ impl PlaceContext {
)
}
+ /// Returns `true` if this place context represents an address-of.
+ pub fn is_address_of(&self) -> bool {
+ matches!(
+ self,
+ PlaceContext::NonMutatingUse(NonMutatingUseContext::AddressOf)
+ | PlaceContext::MutatingUse(MutatingUseContext::AddressOf)
+ )
+ }
+
/// Returns `true` if this place context represents a storage live or storage dead marker.
#[inline]
pub fn is_storage_marker(&self) -> bool {