+use crate::mir::*;
use crate::ty::subst::SubstsRef;
use crate::ty::{CanonicalUserTypeAnnotation, Ty};
-use crate::mir::*;
-use syntax_pos::Span;
+use rustc_span::Span;
// # The MIR Visitor
//
PlaceBase::Local(local) => {
self.visit_local(local, context, location);
}
- PlaceBase::Static(box Static { kind: _, ty, def_id: _ }) => {
+ PlaceBase::Static(box Static { ty, def_id: _ }) => {
self.visit_ty(& $($mutability)? *ty, TyContext::Location(location));
}
}
}
make_mir_visitor!(Visitor,);
-make_mir_visitor!(MutVisitor,mut);
+make_mir_visitor!(MutVisitor, mut);
pub trait MirVisitable<'tcx> {
fn apply(&self, location: Location, visitor: &mut dyn Visitor<'tcx>);
}
impl<'tcx> MirVisitable<'tcx> for Statement<'tcx> {
- fn apply(&self, location: Location, visitor: &mut dyn Visitor<'tcx>)
- {
+ fn apply(&self, location: Location, visitor: &mut dyn Visitor<'tcx>) {
visitor.visit_statement(self, location)
}
}
impl<'tcx> MirVisitable<'tcx> for Terminator<'tcx> {
- fn apply(&self, location: Location, visitor: &mut dyn Visitor<'tcx>)
- {
+ fn apply(&self, location: Location, visitor: &mut dyn Visitor<'tcx>) {
visitor.visit_terminator(self, location)
}
}
impl<'tcx> MirVisitable<'tcx> for Option<Terminator<'tcx>> {
- fn apply(&self, location: Location, visitor: &mut dyn Visitor<'tcx>)
- {
+ fn apply(&self, location: Location, visitor: &mut dyn Visitor<'tcx>) {
visitor.visit_terminator(self.as_ref().unwrap(), location)
}
}
/// Returns `true` if this place context represents a borrow.
pub fn is_borrow(&self) -> bool {
match *self {
- PlaceContext::NonMutatingUse(NonMutatingUseContext::SharedBorrow) |
- PlaceContext::NonMutatingUse(NonMutatingUseContext::ShallowBorrow) |
- PlaceContext::NonMutatingUse(NonMutatingUseContext::UniqueBorrow) |
- PlaceContext::MutatingUse(MutatingUseContext::Borrow) => true,
+ PlaceContext::NonMutatingUse(NonMutatingUseContext::SharedBorrow)
+ | PlaceContext::NonMutatingUse(NonMutatingUseContext::ShallowBorrow)
+ | PlaceContext::NonMutatingUse(NonMutatingUseContext::UniqueBorrow)
+ | PlaceContext::MutatingUse(MutatingUseContext::Borrow) => true,
_ => false,
}
}
/// Returns `true` if this place context represents a storage live or storage dead marker.
pub fn is_storage_marker(&self) -> bool {
match *self {
- PlaceContext::NonUse(NonUseContext::StorageLive) |
- PlaceContext::NonUse(NonUseContext::StorageDead) => true,
+ PlaceContext::NonUse(NonUseContext::StorageLive)
+ | PlaceContext::NonUse(NonUseContext::StorageDead) => true,
_ => false,
}
}
/// Returns `true` if this place context represents an assignment statement.
pub fn is_place_assignment(&self) -> bool {
match *self {
- PlaceContext::MutatingUse(MutatingUseContext::Store) |
- PlaceContext::MutatingUse(MutatingUseContext::Call) |
- PlaceContext::MutatingUse(MutatingUseContext::AsmOutput) => true,
+ PlaceContext::MutatingUse(MutatingUseContext::Store)
+ | PlaceContext::MutatingUse(MutatingUseContext::Call)
+ | PlaceContext::MutatingUse(MutatingUseContext::AsmOutput) => true,
_ => false,
}
}