1 use crate::ty::subst::SubstsRef;
2 use crate::ty::{CanonicalUserTypeAnnotation, ClosureSubsts, GeneratorSubsts, Ty};
10 // There are two visitors, one for immutable and one for mutable references,
11 // but both are generated by the following macro. The code is written according
12 // to the following conventions:
14 // - introduce a `visit_foo` and a `super_foo` method for every MIR type
15 // - `visit_foo`, by default, calls `super_foo`
16 // - `super_foo`, by default, destructures the `foo` and calls `visit_foo`
18 // This allows you as a user to override `visit_foo` for types are
19 // interested in, and invoke (within that method) call
20 // `self.super_foo` to get the default behavior. Just as in an OO
21 // language, you should never call `super` methods ordinarily except
22 // in that circumstance.
24 // For the most part, we do not destructure things external to the
25 // MIR, e.g., types, spans, etc, but simply visit them and stop. This
26 // avoids duplication with other visitors like `TypeFoldable`.
30 // The code is written in a very deliberate style intended to minimize
31 // the chance of things being overlooked. You'll notice that we always
32 // use pattern matching to reference fields and we ensure that all
33 // matches are exhaustive.
35 // For example, the `super_basic_block_data` method begins like this:
38 // fn super_basic_block_data(&mut self,
40 // data: & $($mutability)? BasicBlockData<'tcx>) {
41 // let BasicBlockData {
47 // for statement in statements {
48 // self.visit_statement(block, statement);
55 // Here we used `let BasicBlockData { <fields> } = *data` deliberately,
56 // rather than writing `data.statements` in the body. This is because if one
57 // adds a new field to `BasicBlockData`, one will be forced to revise this code,
58 // and hence one will (hopefully) invoke the correct visit methods (if any).
60 // For this to work, ALL MATCHES MUST BE EXHAUSTIVE IN FIELDS AND VARIANTS.
61 // That means you never write `..` to skip over fields, nor do you write `_`
62 // to skip over variants in a `match`.
64 // The only place that `_` is acceptable is to match a field (or
65 // variant argument) that does not require visiting, as in
66 // `is_cleanup` above.
68 macro_rules! make_mir_visitor {
69 ($visitor_trait_name:ident, $($mutability:ident)?) => {
70 pub trait $visitor_trait_name<'tcx> {
71 // Override these, and call `self.super_xxx` to revert back to the
74 fn visit_body(&mut self, mir: & $($mutability)? Body<'tcx>) {
78 fn visit_basic_block_data(&mut self,
80 data: & $($mutability)? BasicBlockData<'tcx>) {
81 self.super_basic_block_data(block, data);
84 fn visit_source_scope_data(&mut self,
85 scope_data: & $($mutability)? SourceScopeData) {
86 self.super_source_scope_data(scope_data);
89 fn visit_statement(&mut self,
90 statement: & $($mutability)? Statement<'tcx>,
92 self.super_statement(statement, location);
95 fn visit_assign(&mut self,
96 place: & $($mutability)? Place<'tcx>,
97 rvalue: & $($mutability)? Rvalue<'tcx>,
99 self.super_assign(place, rvalue, location);
102 fn visit_terminator(&mut self,
103 terminator: & $($mutability)? Terminator<'tcx>,
104 location: Location) {
105 self.super_terminator(terminator, location);
108 fn visit_terminator_kind(&mut self,
109 kind: & $($mutability)? TerminatorKind<'tcx>,
110 location: Location) {
111 self.super_terminator_kind(kind, location);
114 fn visit_assert_message(&mut self,
115 msg: & $($mutability)? AssertMessage<'tcx>,
116 location: Location) {
117 self.super_assert_message(msg, location);
120 fn visit_rvalue(&mut self,
121 rvalue: & $($mutability)? Rvalue<'tcx>,
122 location: Location) {
123 self.super_rvalue(rvalue, location);
126 fn visit_operand(&mut self,
127 operand: & $($mutability)? Operand<'tcx>,
128 location: Location) {
129 self.super_operand(operand, location);
132 fn visit_ascribe_user_ty(&mut self,
133 place: & $($mutability)? Place<'tcx>,
134 variance: & $($mutability)? ty::Variance,
135 user_ty: & $($mutability)? UserTypeProjection,
136 location: Location) {
137 self.super_ascribe_user_ty(place, variance, user_ty, location);
140 fn visit_retag(&mut self,
141 kind: & $($mutability)? RetagKind,
142 place: & $($mutability)? Place<'tcx>,
143 location: Location) {
144 self.super_retag(kind, place, location);
147 fn visit_place(&mut self,
148 place: & $($mutability)? Place<'tcx>,
149 context: PlaceContext,
150 location: Location) {
151 self.super_place(place, context, location);
154 fn visit_projection(&mut self,
155 place: & $($mutability)? Projection<'tcx>,
156 context: PlaceContext,
157 location: Location) {
158 self.super_projection(place, context, location);
161 fn visit_projection_elem(&mut self,
162 place: & $($mutability)? PlaceElem<'tcx>,
163 location: Location) {
164 self.super_projection_elem(place, location);
167 fn visit_constant(&mut self,
168 constant: & $($mutability)? Constant<'tcx>,
169 location: Location) {
170 self.super_constant(constant, location);
173 fn visit_span(&mut self,
174 span: & $($mutability)? Span) {
175 self.super_span(span);
178 fn visit_source_info(&mut self,
179 source_info: & $($mutability)? SourceInfo) {
180 self.super_source_info(source_info);
183 fn visit_ty(&mut self,
184 ty: $(& $mutability)? Ty<'tcx>,
189 fn visit_user_type_projection(
191 ty: & $($mutability)? UserTypeProjection,
193 self.super_user_type_projection(ty);
196 fn visit_user_type_annotation(
198 index: UserTypeAnnotationIndex,
199 ty: & $($mutability)? CanonicalUserTypeAnnotation<'tcx>,
201 self.super_user_type_annotation(index, ty);
204 fn visit_region(&mut self,
205 region: & $($mutability)? ty::Region<'tcx>,
207 self.super_region(region);
210 fn visit_const(&mut self,
211 constant: & $($mutability)? &'tcx ty::Const<'tcx>,
213 self.super_const(constant);
216 fn visit_substs(&mut self,
217 substs: & $($mutability)? SubstsRef<'tcx>,
219 self.super_substs(substs);
222 fn visit_closure_substs(&mut self,
223 substs: & $($mutability)? ClosureSubsts<'tcx>,
225 self.super_closure_substs(substs);
228 fn visit_generator_substs(&mut self,
229 substs: & $($mutability)? GeneratorSubsts<'tcx>,
231 self.super_generator_substs(substs);
234 fn visit_local_decl(&mut self,
236 local_decl: & $($mutability)? LocalDecl<'tcx>) {
237 self.super_local_decl(local, local_decl);
240 fn visit_local(&mut self,
241 _local: & $($mutability)? Local,
242 _context: PlaceContext,
243 _location: Location) {
246 fn visit_source_scope(&mut self,
247 scope: & $($mutability)? SourceScope) {
248 self.super_source_scope(scope);
251 // The `super_xxx` methods comprise the default behavior and are
252 // not meant to be overridden.
254 fn super_body(&mut self,
255 mir: & $($mutability)? Body<'tcx>) {
256 if let Some(yield_ty) = &$($mutability)? mir.yield_ty {
257 self.visit_ty(yield_ty, TyContext::YieldTy(SourceInfo {
259 scope: OUTERMOST_SOURCE_SCOPE,
263 // for best performance, we want to use an iterator rather
264 // than a for-loop, to avoid calling `mir::Body::invalidate` for
266 macro_rules! basic_blocks {
267 (mut) => (mir.basic_blocks_mut().iter_enumerated_mut());
268 () => (mir.basic_blocks().iter_enumerated());
270 for (bb, data) in basic_blocks!($($mutability)?) {
271 self.visit_basic_block_data(bb, data);
274 for scope in &$($mutability)? mir.source_scopes {
275 self.visit_source_scope_data(scope);
278 self.visit_ty(&$($mutability)? mir.return_ty(), TyContext::ReturnTy(SourceInfo {
280 scope: OUTERMOST_SOURCE_SCOPE,
283 for local in mir.local_decls.indices() {
284 self.visit_local_decl(local, & $($mutability)? mir.local_decls[local]);
287 macro_rules! type_annotations {
288 (mut) => (mir.user_type_annotations.iter_enumerated_mut());
289 () => (mir.user_type_annotations.iter_enumerated());
292 for (index, annotation) in type_annotations!($($mutability)?) {
293 self.visit_user_type_annotation(
298 self.visit_span(&$($mutability)? mir.span);
301 fn super_basic_block_data(&mut self,
303 data: & $($mutability)? BasicBlockData<'tcx>) {
311 for statement in statements {
312 let location = Location { block: block, statement_index: index };
313 self.visit_statement(statement, location);
317 if let Some(terminator) = terminator {
318 let location = Location { block: block, statement_index: index };
319 self.visit_terminator(terminator, location);
323 fn super_source_scope_data(&mut self, scope_data: & $($mutability)? SourceScopeData) {
324 let SourceScopeData {
329 self.visit_span(span);
330 if let Some(parent_scope) = parent_scope {
331 self.visit_source_scope(parent_scope);
335 fn super_statement(&mut self,
336 statement: & $($mutability)? Statement<'tcx>,
337 location: Location) {
343 self.visit_source_info(source_info);
345 StatementKind::Assign(place, rvalue) => {
346 self.visit_assign(place, rvalue, location);
348 StatementKind::FakeRead(_, place) => {
351 PlaceContext::NonMutatingUse(NonMutatingUseContext::Inspect),
355 StatementKind::SetDiscriminant { place, .. } => {
358 PlaceContext::MutatingUse(MutatingUseContext::Store),
362 StatementKind::StorageLive(local) => {
365 PlaceContext::NonUse(NonUseContext::StorageLive),
369 StatementKind::StorageDead(local) => {
372 PlaceContext::NonUse(NonUseContext::StorageDead),
376 StatementKind::InlineAsm(asm) => {
377 for output in & $($mutability)? asm.outputs[..] {
380 PlaceContext::MutatingUse(MutatingUseContext::AsmOutput),
384 for (span, input) in & $($mutability)? asm.inputs[..] {
385 self.visit_span(span);
386 self.visit_operand(input, location);
389 StatementKind::Retag(kind, place) => {
390 self.visit_retag(kind, place, location);
392 StatementKind::AscribeUserType(place, variance, user_ty) => {
393 self.visit_ascribe_user_ty(place, variance, user_ty, location);
395 StatementKind::Nop => {}
399 fn super_assign(&mut self,
400 place: &$($mutability)? Place<'tcx>,
401 rvalue: &$($mutability)? Rvalue<'tcx>,
402 location: Location) {
405 PlaceContext::MutatingUse(MutatingUseContext::Store),
408 self.visit_rvalue(rvalue, location);
411 fn super_terminator(&mut self,
412 terminator: &$($mutability)? Terminator<'tcx>,
413 location: Location) {
414 let Terminator { source_info, kind } = terminator;
416 self.visit_source_info(source_info);
417 self.visit_terminator_kind(kind, location);
420 fn super_terminator_kind(&mut self,
421 kind: & $($mutability)? TerminatorKind<'tcx>,
422 source_location: Location) {
424 TerminatorKind::Goto { .. } |
425 TerminatorKind::Resume |
426 TerminatorKind::Abort |
427 TerminatorKind::Return |
428 TerminatorKind::GeneratorDrop |
429 TerminatorKind::Unreachable |
430 TerminatorKind::FalseEdges { .. } |
431 TerminatorKind::FalseUnwind { .. } => {
434 TerminatorKind::SwitchInt {
440 self.visit_operand(discr, source_location);
441 self.visit_ty(switch_ty, TyContext::Location(source_location));
444 TerminatorKind::Drop {
451 PlaceContext::MutatingUse(MutatingUseContext::Drop),
456 TerminatorKind::DropAndReplace {
464 PlaceContext::MutatingUse(MutatingUseContext::Drop),
467 self.visit_operand(value, source_location);
470 TerminatorKind::Call {
477 self.visit_operand(func, source_location);
479 self.visit_operand(arg, source_location);
481 if let Some((destination, _)) = destination {
484 PlaceContext::MutatingUse(MutatingUseContext::Call),
490 TerminatorKind::Assert {
497 self.visit_operand(cond, source_location);
498 self.visit_assert_message(msg, source_location);
501 TerminatorKind::Yield {
506 self.visit_operand(value, source_location);
512 fn super_assert_message(&mut self,
513 msg: & $($mutability)? AssertMessage<'tcx>,
514 location: Location) {
515 use crate::mir::interpret::InterpError::*;
516 if let BoundsCheck { len, index } = msg {
517 self.visit_operand(len, location);
518 self.visit_operand(index, location);
522 fn super_rvalue(&mut self,
523 rvalue: & $($mutability)? Rvalue<'tcx>,
524 location: Location) {
526 Rvalue::Use(operand) => {
527 self.visit_operand(operand, location);
530 Rvalue::Repeat(value, _) => {
531 self.visit_operand(value, location);
534 Rvalue::Ref(r, bk, path) => {
535 self.visit_region(r, location);
537 BorrowKind::Shared => PlaceContext::NonMutatingUse(
538 NonMutatingUseContext::SharedBorrow
540 BorrowKind::Shallow => PlaceContext::NonMutatingUse(
541 NonMutatingUseContext::ShallowBorrow
543 BorrowKind::Unique => PlaceContext::NonMutatingUse(
544 NonMutatingUseContext::UniqueBorrow
546 BorrowKind::Mut { .. } =>
547 PlaceContext::MutatingUse(MutatingUseContext::Borrow),
549 self.visit_place(path, ctx, location);
552 Rvalue::Len(path) => {
555 PlaceContext::NonMutatingUse(NonMutatingUseContext::Inspect),
560 Rvalue::Cast(_cast_kind, operand, ty) => {
561 self.visit_operand(operand, location);
562 self.visit_ty(ty, TyContext::Location(location));
565 Rvalue::BinaryOp(_bin_op, lhs, rhs)
566 | Rvalue::CheckedBinaryOp(_bin_op, lhs, rhs) => {
567 self.visit_operand(lhs, location);
568 self.visit_operand(rhs, location);
571 Rvalue::UnaryOp(_un_op, op) => {
572 self.visit_operand(op, location);
575 Rvalue::Discriminant(place) => {
578 PlaceContext::NonMutatingUse(NonMutatingUseContext::Inspect),
583 Rvalue::NullaryOp(_op, ty) => {
584 self.visit_ty(ty, TyContext::Location(location));
587 Rvalue::Aggregate(kind, operands) => {
588 let kind = &$($mutability)? **kind;
590 AggregateKind::Array(ty) => {
591 self.visit_ty(ty, TyContext::Location(location));
593 AggregateKind::Tuple => {
602 self.visit_substs(substs, location);
604 AggregateKind::Closure(
608 self.visit_closure_substs(closure_substs, location);
610 AggregateKind::Generator(
615 self.visit_generator_substs(generator_substs, location);
619 for operand in operands {
620 self.visit_operand(operand, location);
626 fn super_operand(&mut self,
627 operand: & $($mutability)? Operand<'tcx>,
628 location: Location) {
630 Operand::Copy(place) => {
633 PlaceContext::NonMutatingUse(NonMutatingUseContext::Copy),
637 Operand::Move(place) => {
640 PlaceContext::NonMutatingUse(NonMutatingUseContext::Move),
644 Operand::Constant(constant) => {
645 self.visit_constant(constant, location);
650 fn super_ascribe_user_ty(&mut self,
651 place: & $($mutability)? Place<'tcx>,
652 _variance: & $($mutability)? ty::Variance,
653 user_ty: & $($mutability)? UserTypeProjection,
654 location: Location) {
657 PlaceContext::NonUse(NonUseContext::AscribeUserTy),
660 self.visit_user_type_projection(user_ty);
663 fn super_retag(&mut self,
664 _kind: & $($mutability)? RetagKind,
665 place: & $($mutability)? Place<'tcx>,
666 location: Location) {
669 PlaceContext::MutatingUse(MutatingUseContext::Retag),
674 fn super_place(&mut self,
675 place: & $($mutability)? Place<'tcx>,
676 context: PlaceContext,
677 location: Location) {
679 Place::Base(PlaceBase::Local(local)) => {
680 self.visit_local(local, context, location);
682 Place::Base(PlaceBase::Static(box Static { kind: _, ty })) => {
683 self.visit_ty(& $($mutability)? *ty, TyContext::Location(location));
685 Place::Projection(proj) => {
686 self.visit_projection(proj, context, location);
691 fn super_projection(&mut self,
692 proj: & $($mutability)? Projection<'tcx>,
693 context: PlaceContext,
694 location: Location) {
695 let Projection { base, elem } = proj;
696 let context = if context.is_mutating_use() {
697 PlaceContext::MutatingUse(MutatingUseContext::Projection)
699 PlaceContext::NonMutatingUse(NonMutatingUseContext::Projection)
701 self.visit_place(base, context, location);
702 self.visit_projection_elem(elem, location);
705 fn super_projection_elem(&mut self,
706 proj: & $($mutability)? PlaceElem<'tcx>,
707 location: Location) {
709 ProjectionElem::Deref => {
711 ProjectionElem::Subslice { from: _, to: _ } => {
713 ProjectionElem::Field(_field, ty) => {
714 self.visit_ty(ty, TyContext::Location(location));
716 ProjectionElem::Index(local) => {
719 PlaceContext::NonMutatingUse(NonMutatingUseContext::Copy),
723 ProjectionElem::ConstantIndex { offset: _,
727 ProjectionElem::Downcast(_name, _variant_index) => {
732 fn super_local_decl(&mut self,
734 local_decl: & $($mutability)? LocalDecl<'tcx>) {
747 self.visit_ty(ty, TyContext::LocalDecl {
749 source_info: *source_info,
751 for (user_ty, _) in & $($mutability)? user_ty.contents {
752 self.visit_user_type_projection(user_ty);
754 self.visit_source_info(source_info);
755 self.visit_source_scope(visibility_scope);
758 fn super_source_scope(&mut self,
759 _scope: & $($mutability)? SourceScope) {
762 fn super_constant(&mut self,
763 constant: & $($mutability)? Constant<'tcx>,
764 location: Location) {
772 self.visit_span(span);
773 self.visit_ty(ty, TyContext::Location(location));
774 drop(user_ty); // no visit method for this
775 self.visit_const(literal, location);
778 fn super_span(&mut self, _span: & $($mutability)? Span) {
781 fn super_source_info(&mut self, source_info: & $($mutability)? SourceInfo) {
787 self.visit_span(span);
788 self.visit_source_scope(scope);
791 fn super_user_type_projection(
793 _ty: & $($mutability)? UserTypeProjection,
797 fn super_user_type_annotation(
799 _index: UserTypeAnnotationIndex,
800 ty: & $($mutability)? CanonicalUserTypeAnnotation<'tcx>,
802 self.visit_span(& $($mutability)? ty.span);
803 self.visit_ty(& $($mutability)? ty.inferred_ty, TyContext::UserTy(ty.span));
806 fn super_ty(&mut self, _ty: $(& $mutability)? Ty<'tcx>) {
809 fn super_region(&mut self, _region: & $($mutability)? ty::Region<'tcx>) {
812 fn super_const(&mut self, _const: & $($mutability)? &'tcx ty::Const<'tcx>) {
815 fn super_substs(&mut self, _substs: & $($mutability)? SubstsRef<'tcx>) {
818 fn super_generator_substs(&mut self,
819 _substs: & $($mutability)? GeneratorSubsts<'tcx>) {
822 fn super_closure_substs(&mut self,
823 _substs: & $($mutability)? ClosureSubsts<'tcx>) {
826 // Convenience methods
828 fn visit_location(&mut self, mir: & $($mutability)? Body<'tcx>, location: Location) {
829 let basic_block = & $($mutability)? mir[location.block];
830 if basic_block.statements.len() == location.statement_index {
831 if let Some(ref $($mutability)? terminator) = basic_block.terminator {
832 self.visit_terminator(terminator, location)
835 let statement = & $($mutability)?
836 basic_block.statements[location.statement_index];
837 self.visit_statement(statement, location)
844 make_mir_visitor!(Visitor,);
845 make_mir_visitor!(MutVisitor,mut);
847 pub trait MirVisitable<'tcx> {
848 fn apply(&self, location: Location, visitor: &mut dyn Visitor<'tcx>);
851 impl<'tcx> MirVisitable<'tcx> for Statement<'tcx> {
852 fn apply(&self, location: Location, visitor: &mut dyn Visitor<'tcx>)
854 visitor.visit_statement(self, location)
858 impl<'tcx> MirVisitable<'tcx> for Terminator<'tcx> {
859 fn apply(&self, location: Location, visitor: &mut dyn Visitor<'tcx>)
861 visitor.visit_terminator(self, location)
865 impl<'tcx> MirVisitable<'tcx> for Option<Terminator<'tcx>> {
866 fn apply(&self, location: Location, visitor: &mut dyn Visitor<'tcx>)
868 visitor.visit_terminator(self.as_ref().unwrap(), location)
872 /// Extra information passed to `visit_ty` and friends to give context
873 /// about where the type etc appears.
874 #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
877 /// The index of the local variable we are visiting.
880 /// The source location where this local variable was declared.
881 source_info: SourceInfo,
884 /// The inferred type of a user type annotation.
887 /// The return type of the function.
888 ReturnTy(SourceInfo),
892 /// A type found at some location.
896 #[derive(Copy, Clone, Debug, PartialEq, Eq)]
897 pub enum NonMutatingUseContext {
898 /// Being inspected in some way, like loading a len.
900 /// Consumed as part of an operand.
902 /// Consumed as part of an operand.
910 /// Used as base for another place, e.g., `x` in `x.y`. Will not mutate the place.
911 /// For example, the projection `x.y` is not marked as a mutation in these cases:
919 #[derive(Copy, Clone, Debug, PartialEq, Eq)]
920 pub enum MutatingUseContext {
921 /// Appears as LHS of an assignment.
923 /// Can often be treated as a `Store`, but needs to be separate because
924 /// ASM is allowed to read outputs as well, so a `Store`-`AsmOutput` sequence
925 /// cannot be simplified the way a `Store`-`Store` can be.
927 /// Destination of a call.
933 /// Used as base for another place, e.g., `x` in `x.y`. Could potentially mutate the place.
934 /// For example, the projection `x.y` is marked as a mutation in these cases:
940 /// Retagging, a "Stacked Borrows" shadow state operation
944 #[derive(Copy, Clone, Debug, PartialEq, Eq)]
945 pub enum NonUseContext {
946 /// Starting a storage live range.
948 /// Ending a storage live range.
950 /// User type annotation assertions for NLL.
954 #[derive(Copy, Clone, Debug, PartialEq, Eq)]
955 pub enum PlaceContext {
956 NonMutatingUse(NonMutatingUseContext),
957 MutatingUse(MutatingUseContext),
958 NonUse(NonUseContext),
961 impl<'tcx> PlaceContext {
962 /// Returns `true` if this place context represents a drop.
963 pub fn is_drop(&self) -> bool {
965 PlaceContext::MutatingUse(MutatingUseContext::Drop) => true,
970 /// Returns `true` if this place context represents a borrow.
971 pub fn is_borrow(&self) -> bool {
973 PlaceContext::NonMutatingUse(NonMutatingUseContext::SharedBorrow) |
974 PlaceContext::NonMutatingUse(NonMutatingUseContext::ShallowBorrow) |
975 PlaceContext::NonMutatingUse(NonMutatingUseContext::UniqueBorrow) |
976 PlaceContext::MutatingUse(MutatingUseContext::Borrow) => true,
981 /// Returns `true` if this place context represents a storage live or storage dead marker.
982 pub fn is_storage_marker(&self) -> bool {
984 PlaceContext::NonUse(NonUseContext::StorageLive) |
985 PlaceContext::NonUse(NonUseContext::StorageDead) => true,
990 /// Returns `true` if this place context represents a storage live marker.
991 pub fn is_storage_live_marker(&self) -> bool {
993 PlaceContext::NonUse(NonUseContext::StorageLive) => true,
998 /// Returns `true` if this place context represents a storage dead marker.
999 pub fn is_storage_dead_marker(&self) -> bool {
1001 PlaceContext::NonUse(NonUseContext::StorageDead) => true,
1006 /// Returns `true` if this place context represents a use that potentially changes the value.
1007 pub fn is_mutating_use(&self) -> bool {
1009 PlaceContext::MutatingUse(..) => true,
1014 /// Returns `true` if this place context represents a use that does not change the value.
1015 pub fn is_nonmutating_use(&self) -> bool {
1017 PlaceContext::NonMutatingUse(..) => true,
1022 /// Returns `true` if this place context represents a use.
1023 pub fn is_use(&self) -> bool {
1025 PlaceContext::NonUse(..) => false,
1030 /// Returns `true` if this place context represents an assignment statement.
1031 pub fn is_place_assignment(&self) -> bool {
1033 PlaceContext::MutatingUse(MutatingUseContext::Store) |
1034 PlaceContext::MutatingUse(MutatingUseContext::Call) |
1035 PlaceContext::MutatingUse(MutatingUseContext::AsmOutput) => true,