@@ -5,12 +5,11 @@ use rustc_middle::mir::{BorrowKind, Mutability, Operand};
5
5
use rustc_middle:: mir:: { InlineAsmOperand , Terminator , TerminatorKind } ;
6
6
use rustc_middle:: mir:: { Statement , StatementKind } ;
7
7
use rustc_middle:: ty:: TyCtxt ;
8
- use std:: iter;
9
8
10
9
use crate :: {
11
10
borrow_set:: BorrowSet , facts:: AllFacts , location:: LocationTable , path_utils:: * , AccessDepth ,
12
- Activation , ArtificialField , BorrowIndex , Deep , JustWrite , LocalMutationIsAllowed , MutateMode ,
13
- Read , ReadKind , ReadOrWrite , Reservation , Shallow , Write , WriteAndRead , WriteKind ,
11
+ Activation , ArtificialField , BorrowIndex , Deep , LocalMutationIsAllowed , Read , ReadKind ,
12
+ ReadOrWrite , Reservation , Shallow , Write , WriteKind ,
14
13
} ;
15
14
16
15
pub ( super ) fn generate_invalidates < ' tcx > (
@@ -59,37 +58,13 @@ impl<'cx, 'tcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx> {
59
58
StatementKind :: Assign ( box ( lhs, rhs) ) => {
60
59
self . consume_rvalue ( location, rhs) ;
61
60
62
- self . mutate_place ( location, * lhs, Shallow ( None ) , JustWrite ) ;
61
+ self . mutate_place ( location, * lhs, Shallow ( None ) ) ;
63
62
}
64
63
StatementKind :: FakeRead ( box ( _, _) ) => {
65
64
// Only relevant for initialized/liveness/safety checks.
66
65
}
67
66
StatementKind :: SetDiscriminant { place, variant_index : _ } => {
68
- self . mutate_place ( location, * * place, Shallow ( None ) , JustWrite ) ;
69
- }
70
- StatementKind :: LlvmInlineAsm ( asm) => {
71
- for ( o, output) in iter:: zip ( & asm. asm . outputs , & * asm. outputs ) {
72
- if o. is_indirect {
73
- // FIXME(eddyb) indirect inline asm outputs should
74
- // be encoded through MIR place derefs instead.
75
- self . access_place (
76
- location,
77
- * output,
78
- ( Deep , Read ( ReadKind :: Copy ) ) ,
79
- LocalMutationIsAllowed :: No ,
80
- ) ;
81
- } else {
82
- self . mutate_place (
83
- location,
84
- * output,
85
- if o. is_rw { Deep } else { Shallow ( None ) } ,
86
- if o. is_rw { WriteAndRead } else { JustWrite } ,
87
- ) ;
88
- }
89
- }
90
- for ( _, input) in asm. inputs . iter ( ) {
91
- self . consume_operand ( location, input) ;
92
- }
67
+ self . mutate_place ( location, * * place, Shallow ( None ) ) ;
93
68
}
94
69
StatementKind :: CopyNonOverlapping ( box rustc_middle:: mir:: CopyNonOverlapping {
95
70
ref src,
@@ -142,7 +117,7 @@ impl<'cx, 'tcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx> {
142
117
target : _,
143
118
unwind : _,
144
119
} => {
145
- self . mutate_place ( location, * drop_place, Deep , JustWrite ) ;
120
+ self . mutate_place ( location, * drop_place, Deep ) ;
146
121
self . consume_operand ( location, new_value) ;
147
122
}
148
123
TerminatorKind :: Call {
@@ -158,7 +133,7 @@ impl<'cx, 'tcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx> {
158
133
self . consume_operand ( location, arg) ;
159
134
}
160
135
if let Some ( ( dest, _ /*bb*/ ) ) = destination {
161
- self . mutate_place ( location, * dest, Deep , JustWrite ) ;
136
+ self . mutate_place ( location, * dest, Deep ) ;
162
137
}
163
138
}
164
139
TerminatorKind :: Assert { ref cond, expected : _, ref msg, target : _, cleanup : _ } => {
@@ -181,7 +156,7 @@ impl<'cx, 'tcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx> {
181
156
}
182
157
}
183
158
184
- self . mutate_place ( location, * resume_arg, Deep , JustWrite ) ;
159
+ self . mutate_place ( location, * resume_arg, Deep ) ;
185
160
}
186
161
TerminatorKind :: Resume | TerminatorKind :: Return | TerminatorKind :: GeneratorDrop => {
187
162
// Invalidate all borrows of local places
@@ -208,13 +183,13 @@ impl<'cx, 'tcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx> {
208
183
}
209
184
InlineAsmOperand :: Out { reg : _, late : _, place, .. } => {
210
185
if let Some ( place) = place {
211
- self . mutate_place ( location, place, Shallow ( None ) , JustWrite ) ;
186
+ self . mutate_place ( location, place, Shallow ( None ) ) ;
212
187
}
213
188
}
214
189
InlineAsmOperand :: InOut { reg : _, late : _, ref in_value, out_place } => {
215
190
self . consume_operand ( location, in_value) ;
216
191
if let Some ( out_place) = out_place {
217
- self . mutate_place ( location, out_place, Shallow ( None ) , JustWrite ) ;
192
+ self . mutate_place ( location, out_place, Shallow ( None ) ) ;
218
193
}
219
194
}
220
195
InlineAsmOperand :: Const { value : _ }
@@ -238,13 +213,7 @@ impl<'cx, 'tcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx> {
238
213
239
214
impl < ' cx , ' tcx > InvalidationGenerator < ' cx , ' tcx > {
240
215
/// Simulates mutation of a place.
241
- fn mutate_place (
242
- & mut self ,
243
- location : Location ,
244
- place : Place < ' tcx > ,
245
- kind : AccessDepth ,
246
- _mode : MutateMode ,
247
- ) {
216
+ fn mutate_place ( & mut self , location : Location , place : Place < ' tcx > , kind : AccessDepth ) {
248
217
self . access_place (
249
218
location,
250
219
place,
0 commit comments