11use rustc_index:: bit_set:: { BitSet , ChunkedBitSet } ;
22use 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 } ;
54
65use crate :: { Analysis , AnalysisDomain , Backward , CallReturnPlaces , GenKill , GenKillAnalysis } ;
76
@@ -193,27 +192,21 @@ impl DefUse {
193192/// This is basically written for dead store elimination and nothing else.
194193///
195194/// All of the caveats of `MaybeLiveLocals` apply.
196- pub struct MaybeTransitiveLiveLocals < ' a , ' tcx > {
195+ pub struct MaybeTransitiveLiveLocals < ' a > {
197196 always_live : & ' a BitSet < Local > ,
198- local_decls : & ' a LocalDecls < ' tcx > ,
199- tcx : TyCtxt < ' tcx > ,
200197}
201198
202- impl < ' a , ' tcx > MaybeTransitiveLiveLocals < ' a , ' tcx > {
199+ impl < ' a > MaybeTransitiveLiveLocals < ' a > {
203200 /// The `always_alive` set is the set of locals to which all stores should unconditionally be
204201 /// considered live.
205202 ///
206203 /// 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 }
213206 }
214207}
215208
216- impl < ' a , ' tcx > AnalysisDomain < ' tcx > for MaybeTransitiveLiveLocals < ' a , ' tcx > {
209+ impl < ' a , ' tcx > AnalysisDomain < ' tcx > for MaybeTransitiveLiveLocals < ' a > {
217210 type Domain = ChunkedBitSet < Local > ;
218211 type Direction = Backward ;
219212
@@ -241,7 +234,7 @@ impl<'a> GenKill<Local> for TransferWrapper<'a> {
241234 }
242235}
243236
244- impl < ' a , ' tcx > Analysis < ' tcx > for MaybeTransitiveLiveLocals < ' a , ' tcx > {
237+ impl < ' a , ' tcx > Analysis < ' tcx > for MaybeTransitiveLiveLocals < ' a > {
245238 fn apply_statement_effect (
246239 & self ,
247240 trans : & mut Self :: Domain ,
@@ -251,7 +244,7 @@ impl<'a, 'tcx> Analysis<'tcx> for MaybeTransitiveLiveLocals<'a, 'tcx> {
251244 // Compute the place that we are storing to, if any
252245 let destination = match & statement. kind {
253246 StatementKind :: Assign ( assign) => {
254- if assign. 1 . is_pointer_int_cast ( self . local_decls , self . tcx ) {
247+ if assign. 1 . is_pointer_int_cast ( ) {
255248 // Pointer to int casts may be side-effects due to exposing the provenance.
256249 // While the model is undecided, we should be conservative. See
257250 // <https://www.ralfj.de/blog/2022/04/11/provenance-exposed.html>
0 commit comments