@@ -54,7 +54,6 @@ use rustc_mir_dataflow::MoveDataParamEnv;
54
54
use self :: diagnostics:: { AccessKind , RegionName } ;
55
55
use self :: location:: LocationTable ;
56
56
use self :: prefixes:: PrefixSet ;
57
- use self :: MutateMode :: JustWrite ;
58
57
use facts:: AllFacts ;
59
58
60
59
use self :: path_utils:: * ;
@@ -629,7 +628,7 @@ impl<'cx, 'tcx> rustc_mir_dataflow::ResultsVisitor<'cx, 'tcx> for MirBorrowckCtx
629
628
StatementKind :: Assign ( box ( lhs, ref rhs) ) => {
630
629
self . consume_rvalue ( location, ( rhs, span) , flow_state) ;
631
630
632
- self . mutate_place ( location, ( * lhs, span) , Shallow ( None ) , JustWrite , flow_state) ;
631
+ self . mutate_place ( location, ( * lhs, span) , Shallow ( None ) , flow_state) ;
633
632
}
634
633
StatementKind :: FakeRead ( box ( _, ref place) ) => {
635
634
// Read for match doesn't access any memory and is used to
@@ -650,7 +649,7 @@ impl<'cx, 'tcx> rustc_mir_dataflow::ResultsVisitor<'cx, 'tcx> for MirBorrowckCtx
650
649
) ;
651
650
}
652
651
StatementKind :: SetDiscriminant { place, variant_index : _ } => {
653
- self . mutate_place ( location, ( * * place, span) , Shallow ( None ) , JustWrite , flow_state) ;
652
+ self . mutate_place ( location, ( * * place, span) , Shallow ( None ) , flow_state) ;
654
653
}
655
654
StatementKind :: CopyNonOverlapping ( box rustc_middle:: mir:: CopyNonOverlapping {
656
655
..
@@ -716,7 +715,7 @@ impl<'cx, 'tcx> rustc_mir_dataflow::ResultsVisitor<'cx, 'tcx> for MirBorrowckCtx
716
715
target : _,
717
716
unwind : _,
718
717
} => {
719
- self . mutate_place ( loc, ( drop_place, span) , Deep , JustWrite , flow_state) ;
718
+ self . mutate_place ( loc, ( drop_place, span) , Deep , flow_state) ;
720
719
self . consume_operand ( loc, ( new_value, span) , flow_state) ;
721
720
}
722
721
TerminatorKind :: Call {
@@ -732,7 +731,7 @@ impl<'cx, 'tcx> rustc_mir_dataflow::ResultsVisitor<'cx, 'tcx> for MirBorrowckCtx
732
731
self . consume_operand ( loc, ( arg, span) , flow_state) ;
733
732
}
734
733
if let Some ( ( dest, _ /*bb*/ ) ) = * destination {
735
- self . mutate_place ( loc, ( dest, span) , Deep , JustWrite , flow_state) ;
734
+ self . mutate_place ( loc, ( dest, span) , Deep , flow_state) ;
736
735
}
737
736
}
738
737
TerminatorKind :: Assert { ref cond, expected : _, ref msg, target : _, cleanup : _ } => {
@@ -746,7 +745,7 @@ impl<'cx, 'tcx> rustc_mir_dataflow::ResultsVisitor<'cx, 'tcx> for MirBorrowckCtx
746
745
747
746
TerminatorKind :: Yield { ref value, resume : _, resume_arg, drop : _ } => {
748
747
self . consume_operand ( loc, ( value, span) , flow_state) ;
749
- self . mutate_place ( loc, ( resume_arg, span) , Deep , JustWrite , flow_state) ;
748
+ self . mutate_place ( loc, ( resume_arg, span) , Deep , flow_state) ;
750
749
}
751
750
752
751
TerminatorKind :: InlineAsm {
@@ -764,13 +763,7 @@ impl<'cx, 'tcx> rustc_mir_dataflow::ResultsVisitor<'cx, 'tcx> for MirBorrowckCtx
764
763
}
765
764
InlineAsmOperand :: Out { reg : _, late : _, place, .. } => {
766
765
if let Some ( place) = place {
767
- self . mutate_place (
768
- loc,
769
- ( place, span) ,
770
- Shallow ( None ) ,
771
- JustWrite ,
772
- flow_state,
773
- ) ;
766
+ self . mutate_place ( loc, ( place, span) , Shallow ( None ) , flow_state) ;
774
767
}
775
768
}
776
769
InlineAsmOperand :: InOut { reg : _, late : _, ref in_value, out_place } => {
@@ -780,7 +773,6 @@ impl<'cx, 'tcx> rustc_mir_dataflow::ResultsVisitor<'cx, 'tcx> for MirBorrowckCtx
780
773
loc,
781
774
( out_place, span) ,
782
775
Shallow ( None ) ,
783
- JustWrite ,
784
776
flow_state,
785
777
) ;
786
778
}
@@ -852,12 +844,6 @@ impl<'cx, 'tcx> rustc_mir_dataflow::ResultsVisitor<'cx, 'tcx> for MirBorrowckCtx
852
844
}
853
845
}
854
846
855
- #[ derive( Copy , Clone , PartialEq , Eq , Debug ) ]
856
- enum MutateMode {
857
- JustWrite ,
858
- WriteAndRead ,
859
- }
860
-
861
847
use self :: AccessDepth :: { Deep , Shallow } ;
862
848
use self :: ReadOrWrite :: { Activation , Read , Reservation , Write } ;
863
849
@@ -943,7 +929,6 @@ enum LocalMutationIsAllowed {
943
929
944
930
#[ derive( Copy , Clone , Debug ) ]
945
931
enum InitializationRequiringAction {
946
- Update ,
947
932
Borrow ,
948
933
MatchOn ,
949
934
Use ,
@@ -960,7 +945,6 @@ struct RootPlace<'tcx> {
960
945
impl InitializationRequiringAction {
961
946
fn as_noun ( self ) -> & ' static str {
962
947
match self {
963
- InitializationRequiringAction :: Update => "update" ,
964
948
InitializationRequiringAction :: Borrow => "borrow" ,
965
949
InitializationRequiringAction :: MatchOn => "use" , // no good noun
966
950
InitializationRequiringAction :: Use => "use" ,
@@ -971,7 +955,6 @@ impl InitializationRequiringAction {
971
955
972
956
fn as_verb_in_past_tense ( self ) -> & ' static str {
973
957
match self {
974
- InitializationRequiringAction :: Update => "updated" ,
975
958
InitializationRequiringAction :: Borrow => "borrowed" ,
976
959
InitializationRequiringAction :: MatchOn => "matched on" ,
977
960
InitializationRequiringAction :: Use => "used" ,
@@ -1208,23 +1191,10 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1208
1191
location : Location ,
1209
1192
place_span : ( Place < ' tcx > , Span ) ,
1210
1193
kind : AccessDepth ,
1211
- mode : MutateMode ,
1212
1194
flow_state : & Flows < ' cx , ' tcx > ,
1213
1195
) {
1214
- // Write of P[i] or *P, or WriteAndRead of any P, requires P init'd.
1215
- match mode {
1216
- MutateMode :: WriteAndRead => {
1217
- self . check_if_path_or_subpath_is_moved (
1218
- location,
1219
- InitializationRequiringAction :: Update ,
1220
- ( place_span. 0 . as_ref ( ) , place_span. 1 ) ,
1221
- flow_state,
1222
- ) ;
1223
- }
1224
- MutateMode :: JustWrite => {
1225
- self . check_if_assigned_path_is_moved ( location, place_span, flow_state) ;
1226
- }
1227
- }
1196
+ // Write of P[i] or *P requires P init'd.
1197
+ self . check_if_assigned_path_is_moved ( location, place_span, flow_state) ;
1228
1198
1229
1199
// Special case: you can assign an immutable local variable
1230
1200
// (e.g., `x = ...`) so long as it has never been initialized
0 commit comments