X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustc_mir%2Ftransform%2Felaborate_drops.rs;h=bf6237fa91acfe4683a57f89ee4a64bc57132813;hb=fff08cb04389497d254fb40948674cbbee402908;hp=c48b94bded65179a80b09cc60748b622813a6e5c;hpb=17393b26b961937cda562a2f4bb5e80b2ce49b1e;p=rust.git diff --git a/src/librustc_mir/transform/elaborate_drops.rs b/src/librustc_mir/transform/elaborate_drops.rs index c48b94bded6..bf6237fa91a 100644 --- a/src/librustc_mir/transform/elaborate_drops.rs +++ b/src/librustc_mir/transform/elaborate_drops.rs @@ -21,11 +21,7 @@ pub struct ElaborateDrops; impl MirPass for ElaborateDrops { - fn run_pass<'a, 'tcx>(&self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, - src: MirSource<'tcx>, - body: &mut Body<'tcx>) - { + fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>, src: MirSource<'tcx>, body: &mut Body<'tcx>) { debug!("elaborate_drops({:?} @ {:?})", src, body.span); let def_id = src.def_id(); @@ -77,13 +73,12 @@ fn run_pass<'a, 'tcx>(&self, /// Returns the set of basic blocks whose unwind edges are known /// to not be reachable, because they are `drop` terminators /// that can't drop anything. -fn find_dead_unwinds<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn find_dead_unwinds<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, body: &Body<'tcx>, def_id: hir::def_id::DefId, - env: &MoveDataParamEnv<'tcx, 'tcx>) - -> BitSet -{ + env: &MoveDataParamEnv<'tcx, 'tcx>, +) -> BitSet { debug!("find_dead_unwinds({:?})", body.span); // We only need to do this pass once, because unwind edges can only // reach cleanup blocks, which can't have unwind edges themselves. @@ -141,12 +136,13 @@ struct InitializationData { } impl InitializationData { - fn apply_location<'a,'tcx>(&mut self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, - body: &Body<'tcx>, - env: &MoveDataParamEnv<'tcx, 'tcx>, - loc: Location) - { + fn apply_location<'tcx>( + &mut self, + tcx: TyCtxt<'tcx, 'tcx>, + body: &Body<'tcx>, + env: &MoveDataParamEnv<'tcx, 'tcx>, + loc: Location, + ) { drop_flag_effects_for_location(tcx, body, env, loc, |path, df| { debug!("at location {:?}: setting {:?} to {:?}", loc, path, df); @@ -190,7 +186,7 @@ fn body(&self) -> &'a Body<'tcx> { self.ctxt.body } - fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.ctxt.tcx } @@ -290,11 +286,11 @@ fn get_drop_flag(&mut self, path: Self::Path) -> Option> { } struct ElaborateDropsCtxt<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body: &'a Body<'tcx>, env: &'a MoveDataParamEnv<'tcx, 'tcx>, flow_inits: DataflowResults<'tcx, MaybeInitializedPlaces<'a, 'tcx, 'tcx>>, - flow_uninits: DataflowResults<'tcx, MaybeUninitializedPlaces<'a, 'tcx, 'tcx>>, + flow_uninits: DataflowResults<'tcx, MaybeUninitializedPlaces<'a, 'tcx, 'tcx>>, drop_flags: FxHashMap, patch: MirPatch<'tcx>, }