Skip to content

Commit d110d30

Browse files
committed
rustc_mir: deny(unused_lifetimes).
1 parent 7dc3494 commit d110d30

File tree

13 files changed

+27
-26
lines changed

13 files changed

+27
-26
lines changed

src/librustc_mir/borrow_check/nll/invalidation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ impl<'cx, 'tcx, 'gcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx, 'gcx> {
258258
}
259259
}
260260

261-
impl<'cg, 'cx, 'tcx, 'gcx> InvalidationGenerator<'cx, 'tcx, 'gcx> {
261+
impl<'cx, 'tcx, 'gcx> InvalidationGenerator<'cx, 'tcx, 'gcx> {
262262
/// Simulates mutation of a place.
263263
fn mutate_place(
264264
&mut self,

src/librustc_mir/borrow_check/path_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rustc_data_structures::graph::dominators::Dominators;
1010
/// Returns `true` if the borrow represented by `kind` is
1111
/// allowed to be split into separate Reservation and
1212
/// Activation phases.
13-
pub(super) fn allow_two_phase_borrow<'a, 'tcx, 'gcx: 'tcx>(kind: BorrowKind) -> bool {
13+
pub(super) fn allow_two_phase_borrow(kind: BorrowKind) -> bool {
1414
kind.allows_two_phase_borrow()
1515
}
1616

src/librustc_mir/build/matches/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1575,7 +1575,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
15751575

15761576
/// Append `AscribeUserType` statements onto the end of `block`
15771577
/// for each ascription
1578-
fn ascribe_types<'pat>(
1578+
fn ascribe_types(
15791579
&mut self,
15801580
block: BasicBlock,
15811581
ascriptions: &[Ascription<'tcx>],

src/librustc_mir/build/matches/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
463463
/// that it *doesn't* apply. For now, we return false, indicate that the
464464
/// test does not apply to this candidate, but it might be we can get
465465
/// tighter match code if we do something a bit different.
466-
pub fn sort_candidate<'pat, 'cand>(
466+
pub fn sort_candidate<'pat>(
467467
&mut self,
468468
test_place: &Place<'tcx>,
469469
test: &Test<'tcx>,

src/librustc_mir/interpret/snapshot.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ struct FrameSnapshot<'a, 'tcx: 'a> {
315315
stmt: usize,
316316
}
317317

318-
impl_stable_hash_for!(impl<'mir, 'tcx: 'mir> for struct Frame<'mir, 'tcx> {
318+
impl_stable_hash_for!(impl<> for struct Frame<'mir, 'tcx> {
319319
body,
320320
instance,
321321
span,
@@ -422,7 +422,7 @@ impl<'a, 'mir, 'tcx> Hash for InterpSnapshot<'a, 'mir, 'tcx>
422422
}
423423
}
424424

425-
impl_stable_hash_for!(impl<'tcx, 'b, 'mir> for struct InterpSnapshot<'b, 'mir, 'tcx> {
425+
impl_stable_hash_for!(impl<> for struct InterpSnapshot<'_, 'mir, 'tcx> {
426426
// Not hashing memory: Avoid hashing memory all the time during execution
427427
memory -> _,
428428
stack,

src/librustc_mir/interpret/validity.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pub struct RefTracking<T> {
8181
pub todo: Vec<(T, Vec<PathElem>)>,
8282
}
8383

84-
impl<'tcx, T: Copy + Eq + Hash> RefTracking<T> {
84+
impl<T: Copy + Eq + Hash> RefTracking<T> {
8585
pub fn new(op: T) -> Self {
8686
let mut ref_tracking = RefTracking {
8787
seen: FxHashSet::default(),

src/librustc_mir/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
2929

3030
#![deny(rust_2018_idioms)]
3131
#![deny(internal)]
32+
#![deny(unused_lifetimes)]
3233
#![allow(explicit_outlives_requirements)]
3334

3435
#[macro_use] extern crate log;

src/librustc_mir/monomorphize/collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,7 @@ fn find_vtable_types_for_unsizing<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
907907
}
908908
}
909909

910-
fn create_fn_mono_item<'a, 'tcx>(instance: Instance<'tcx>) -> MonoItem<'tcx> {
910+
fn create_fn_mono_item<'tcx>(instance: Instance<'tcx>) -> MonoItem<'tcx> {
911911
debug!("create_fn_mono_item(instance={})", instance);
912912
MonoItem::Fn(instance)
913913
}

src/librustc_mir/transform/check_unsafety.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub struct UnsafetyChecker<'a, 'tcx: 'a> {
3232
inherited_blocks: Vec<(hir::HirId, bool)>,
3333
}
3434

35-
impl<'a, 'gcx, 'tcx> UnsafetyChecker<'a, 'tcx> {
35+
impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> {
3636
fn new(
3737
const_context: bool,
3838
min_const_fn: bool,

src/librustc_mir/transform/generator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -829,14 +829,14 @@ fn create_generator_resume_function<'a, 'tcx>(
829829
dump_mir(tcx, None, "generator_resume", &0, source, body, |_, _| Ok(()) );
830830
}
831831

832-
fn source_info<'a, 'tcx>(body: &Body<'tcx>) -> SourceInfo {
832+
fn source_info<'tcx>(body: &Body<'tcx>) -> SourceInfo {
833833
SourceInfo {
834834
span: body.span,
835835
scope: OUTERMOST_SOURCE_SCOPE,
836836
}
837837
}
838838

839-
fn insert_clean_drop<'a, 'tcx>(body: &mut Body<'tcx>) -> BasicBlock {
839+
fn insert_clean_drop<'tcx>(body: &mut Body<'tcx>) -> BasicBlock {
840840
let return_block = insert_term_block(body, TerminatorKind::Return);
841841

842842
// Create a block to destroy an unresumed generators. This can only destroy upvars.

src/librustc_mir/transform/simplify.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ impl MirPass for SimplifyLocals {
323323
}
324324

325325
/// Construct the mapping while swapping out unused stuff out from the `vec`.
326-
fn make_local_map<'tcx, V>(
326+
fn make_local_map<V>(
327327
vec: &mut IndexVec<Local, V>,
328328
mask: BitSet<Local>,
329329
) -> IndexVec<Local, Option<Local>> {

src/librustc_mir/util/elaborate_drops.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
147147
//
148148
// FIXME: I think we should just control the flags externally,
149149
// and then we do not need this machinery.
150-
pub fn elaborate_drop<'a>(&mut self, bb: BasicBlock) {
150+
pub fn elaborate_drop(&mut self, bb: BasicBlock) {
151151
debug!("elaborate_drop({:?})", self);
152152
let style = self.elaborator.drop_style(self.path, DropFlagMode::Deep);
153153
debug!("elaborate_drop({:?}): live - {:?}", self, style);
@@ -285,7 +285,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
285285
///
286286
/// NOTE: this does not clear the master drop flag, so you need
287287
/// to point succ/unwind on a `drop_ladder_bottom`.
288-
fn drop_ladder<'a>(&mut self,
288+
fn drop_ladder(&mut self,
289289
fields: Vec<(Place<'tcx>, Option<D::Path>)>,
290290
succ: BasicBlock,
291291
unwind: Unwind)
@@ -314,7 +314,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
314314
(*normal_ladder.last().unwrap(), *unwind_ladder.last().unwrap())
315315
}
316316

317-
fn open_drop_for_tuple<'a>(&mut self, tys: &[Ty<'tcx>])
317+
fn open_drop_for_tuple(&mut self, tys: &[Ty<'tcx>])
318318
-> BasicBlock
319319
{
320320
debug!("open_drop_for_tuple({:?}, {:?})", self, tys);
@@ -328,7 +328,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
328328
self.drop_ladder(fields, succ, unwind).0
329329
}
330330

331-
fn open_drop_for_box<'a>(&mut self, adt: &'tcx ty::AdtDef, substs: SubstsRef<'tcx>)
331+
fn open_drop_for_box(&mut self, adt: &'tcx ty::AdtDef, substs: SubstsRef<'tcx>)
332332
-> BasicBlock
333333
{
334334
debug!("open_drop_for_box({:?}, {:?}, {:?})", self, adt, substs);
@@ -346,7 +346,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
346346
self.drop_subpath(&interior, interior_path, succ, unwind_succ)
347347
}
348348

349-
fn open_drop_for_adt<'a>(&mut self, adt: &'tcx ty::AdtDef, substs: SubstsRef<'tcx>)
349+
fn open_drop_for_adt(&mut self, adt: &'tcx ty::AdtDef, substs: SubstsRef<'tcx>)
350350
-> BasicBlock {
351351
debug!("open_drop_for_adt({:?}, {:?}, {:?})", self, adt, substs);
352352
if adt.variants.len() == 0 {
@@ -505,7 +505,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
505505
self.drop_flag_test_block(switch_block, succ, unwind)
506506
}
507507

508-
fn destructor_call_block<'a>(&mut self, (succ, unwind): (BasicBlock, Unwind))
508+
fn destructor_call_block(&mut self, (succ, unwind): (BasicBlock, Unwind))
509509
-> BasicBlock
510510
{
511511
debug!("destructor_call_block({:?}, {:?})", self, succ);
@@ -787,7 +787,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
787787
///
788788
/// This creates a "drop ladder" that drops the needed fields of the
789789
/// ADT, both in the success case or if one of the destructors fail.
790-
fn open_drop<'a>(&mut self) -> BasicBlock {
790+
fn open_drop(&mut self) -> BasicBlock {
791791
let ty = self.place_ty(self.place);
792792
match ty.sty {
793793
ty::Closure(def_id, substs) => {
@@ -837,7 +837,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
837837
/// if FLAG(self.path)
838838
/// if let Some(mode) = mode: FLAG(self.path)[mode] = false
839839
/// drop(self.place)
840-
fn complete_drop<'a>(&mut self,
840+
fn complete_drop(&mut self,
841841
drop_mode: Option<DropFlagMode>,
842842
succ: BasicBlock,
843843
unwind: Unwind) -> BasicBlock
@@ -867,7 +867,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
867867
block
868868
}
869869

870-
fn elaborated_drop_block<'a>(&mut self) -> BasicBlock {
870+
fn elaborated_drop_block(&mut self) -> BasicBlock {
871871
debug!("elaborated_drop_block({:?})", self);
872872
let unwind = self.unwind; // FIXME(#43234)
873873
let succ = self.succ;
@@ -876,7 +876,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
876876
blk
877877
}
878878

879-
fn box_free_block<'a>(
879+
fn box_free_block(
880880
&mut self,
881881
adt: &'tcx ty::AdtDef,
882882
substs: SubstsRef<'tcx>,
@@ -887,7 +887,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
887887
self.drop_flag_test_block(block, target, unwind)
888888
}
889889

890-
fn unelaborated_free_block<'a>(
890+
fn unelaborated_free_block(
891891
&mut self,
892892
adt: &'tcx ty::AdtDef,
893893
substs: SubstsRef<'tcx>,
@@ -917,7 +917,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
917917
free_block
918918
}
919919

920-
fn drop_block<'a>(&mut self, target: BasicBlock, unwind: Unwind) -> BasicBlock {
920+
fn drop_block(&mut self, target: BasicBlock, unwind: Unwind) -> BasicBlock {
921921
let block = TerminatorKind::Drop {
922922
location: self.place.clone(),
923923
target,
@@ -947,7 +947,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
947947
}
948948
}
949949

950-
fn new_block<'a>(&mut self,
950+
fn new_block(&mut self,
951951
unwind: Unwind,
952952
k: TerminatorKind<'tcx>)
953953
-> BasicBlock

src/librustc_mir/util/liveness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ pub enum DefUse {
109109
Drop,
110110
}
111111

112-
pub fn categorize<'tcx>(context: PlaceContext) -> Option<DefUse> {
112+
pub fn categorize(context: PlaceContext) -> Option<DefUse> {
113113
match context {
114114
///////////////////////////////////////////////////////////////////////////
115115
// DEFS

0 commit comments

Comments
 (0)