1
1
use rustc_index:: bit_set:: { BitSet , ChunkedBitSet } ;
2
2
use rustc_middle:: mir:: visit:: { MutatingUseContext , NonMutatingUseContext , PlaceContext , Visitor } ;
3
- use rustc_middle:: mir:: { self , Local , LocalDecls , Location , Place , StatementKind } ;
4
- use rustc_middle:: ty:: TyCtxt ;
3
+ use rustc_middle:: mir:: { self , Local , Location , Place , StatementKind } ;
5
4
6
5
use crate :: { Analysis , AnalysisDomain , Backward , CallReturnPlaces , GenKill , GenKillAnalysis } ;
7
6
@@ -193,27 +192,21 @@ impl DefUse {
193
192
/// This is basically written for dead store elimination and nothing else.
194
193
///
195
194
/// All of the caveats of `MaybeLiveLocals` apply.
196
- pub struct MaybeTransitiveLiveLocals < ' a , ' tcx > {
195
+ pub struct MaybeTransitiveLiveLocals < ' a > {
197
196
always_live : & ' a BitSet < Local > ,
198
- local_decls : & ' a LocalDecls < ' tcx > ,
199
- tcx : TyCtxt < ' tcx > ,
200
197
}
201
198
202
- impl < ' a , ' tcx > MaybeTransitiveLiveLocals < ' a , ' tcx > {
199
+ impl < ' a > MaybeTransitiveLiveLocals < ' a > {
203
200
/// The `always_alive` set is the set of locals to which all stores should unconditionally be
204
201
/// considered live.
205
202
///
206
203
/// This should include at least all locals that are ever borrowed.
207
- pub fn new (
208
- always_live : & ' a BitSet < Local > ,
209
- local_decls : & ' a LocalDecls < ' tcx > ,
210
- tcx : TyCtxt < ' tcx > ,
211
- ) -> Self {
212
- MaybeTransitiveLiveLocals { always_live, local_decls, tcx }
204
+ pub fn new ( always_live : & ' a BitSet < Local > ) -> Self {
205
+ MaybeTransitiveLiveLocals { always_live }
213
206
}
214
207
}
215
208
216
- impl < ' a , ' tcx > AnalysisDomain < ' tcx > for MaybeTransitiveLiveLocals < ' a , ' tcx > {
209
+ impl < ' a , ' tcx > AnalysisDomain < ' tcx > for MaybeTransitiveLiveLocals < ' a > {
217
210
type Domain = ChunkedBitSet < Local > ;
218
211
type Direction = Backward ;
219
212
@@ -241,7 +234,7 @@ impl<'a> GenKill<Local> for TransferWrapper<'a> {
241
234
}
242
235
}
243
236
244
- impl < ' a , ' tcx > Analysis < ' tcx > for MaybeTransitiveLiveLocals < ' a , ' tcx > {
237
+ impl < ' a , ' tcx > Analysis < ' tcx > for MaybeTransitiveLiveLocals < ' a > {
245
238
fn apply_statement_effect (
246
239
& self ,
247
240
trans : & mut Self :: Domain ,
@@ -251,7 +244,7 @@ impl<'a, 'tcx> Analysis<'tcx> for MaybeTransitiveLiveLocals<'a, 'tcx> {
251
244
// Compute the place that we are storing to, if any
252
245
let destination = match & statement. kind {
253
246
StatementKind :: Assign ( assign) => {
254
- if assign. 1 . is_pointer_int_cast ( self . local_decls , self . tcx ) {
247
+ if assign. 1 . is_pointer_int_cast ( ) {
255
248
// Pointer to int casts may be side-effects due to exposing the provenance.
256
249
// While the model is undecided, we should be conservative. See
257
250
// <https://www.ralfj.de/blog/2022/04/11/provenance-exposed.html>
0 commit comments