Skip to content

Commit

Permalink
rustc_mir: deny(unused_lifetimes).
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyb committed Jun 11, 2019
1 parent 7dc3494 commit d110d30
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/librustc_mir/borrow_check/nll/invalidation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ impl<'cx, 'tcx, 'gcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx, 'gcx> {
}
}

impl<'cg, 'cx, 'tcx, 'gcx> InvalidationGenerator<'cx, 'tcx, 'gcx> {
impl<'cx, 'tcx, 'gcx> InvalidationGenerator<'cx, 'tcx, 'gcx> {
/// Simulates mutation of a place.
fn mutate_place(
&mut self,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/borrow_check/path_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use rustc_data_structures::graph::dominators::Dominators;
/// Returns `true` if the borrow represented by `kind` is
/// allowed to be split into separate Reservation and
/// Activation phases.
pub(super) fn allow_two_phase_borrow<'a, 'tcx, 'gcx: 'tcx>(kind: BorrowKind) -> bool {
pub(super) fn allow_two_phase_borrow(kind: BorrowKind) -> bool {
kind.allows_two_phase_borrow()
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/build/matches/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1575,7 +1575,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {

/// Append `AscribeUserType` statements onto the end of `block`
/// for each ascription
fn ascribe_types<'pat>(
fn ascribe_types(
&mut self,
block: BasicBlock,
ascriptions: &[Ascription<'tcx>],
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/build/matches/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
/// that it *doesn't* apply. For now, we return false, indicate that the
/// test does not apply to this candidate, but it might be we can get
/// tighter match code if we do something a bit different.
pub fn sort_candidate<'pat, 'cand>(
pub fn sort_candidate<'pat>(
&mut self,
test_place: &Place<'tcx>,
test: &Test<'tcx>,
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_mir/interpret/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ struct FrameSnapshot<'a, 'tcx: 'a> {
stmt: usize,
}

impl_stable_hash_for!(impl<'mir, 'tcx: 'mir> for struct Frame<'mir, 'tcx> {
impl_stable_hash_for!(impl<> for struct Frame<'mir, 'tcx> {
body,
instance,
span,
Expand Down Expand Up @@ -422,7 +422,7 @@ impl<'a, 'mir, 'tcx> Hash for InterpSnapshot<'a, 'mir, 'tcx>
}
}

impl_stable_hash_for!(impl<'tcx, 'b, 'mir> for struct InterpSnapshot<'b, 'mir, 'tcx> {
impl_stable_hash_for!(impl<> for struct InterpSnapshot<'_, 'mir, 'tcx> {
// Not hashing memory: Avoid hashing memory all the time during execution
memory -> _,
stack,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/interpret/validity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pub struct RefTracking<T> {
pub todo: Vec<(T, Vec<PathElem>)>,
}

impl<'tcx, T: Copy + Eq + Hash> RefTracking<T> {
impl<T: Copy + Eq + Hash> RefTracking<T> {
pub fn new(op: T) -> Self {
let mut ref_tracking = RefTracking {
seen: FxHashSet::default(),
Expand Down
1 change: 1 addition & 0 deletions src/librustc_mir/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!

#![deny(rust_2018_idioms)]
#![deny(internal)]
#![deny(unused_lifetimes)]
#![allow(explicit_outlives_requirements)]

#[macro_use] extern crate log;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/monomorphize/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ fn find_vtable_types_for_unsizing<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
}
}

fn create_fn_mono_item<'a, 'tcx>(instance: Instance<'tcx>) -> MonoItem<'tcx> {
fn create_fn_mono_item<'tcx>(instance: Instance<'tcx>) -> MonoItem<'tcx> {
debug!("create_fn_mono_item(instance={})", instance);
MonoItem::Fn(instance)
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/transform/check_unsafety.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub struct UnsafetyChecker<'a, 'tcx: 'a> {
inherited_blocks: Vec<(hir::HirId, bool)>,
}

impl<'a, 'gcx, 'tcx> UnsafetyChecker<'a, 'tcx> {
impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> {
fn new(
const_context: bool,
min_const_fn: bool,
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_mir/transform/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -829,14 +829,14 @@ fn create_generator_resume_function<'a, 'tcx>(
dump_mir(tcx, None, "generator_resume", &0, source, body, |_, _| Ok(()) );
}

fn source_info<'a, 'tcx>(body: &Body<'tcx>) -> SourceInfo {
fn source_info<'tcx>(body: &Body<'tcx>) -> SourceInfo {
SourceInfo {
span: body.span,
scope: OUTERMOST_SOURCE_SCOPE,
}
}

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

// Create a block to destroy an unresumed generators. This can only destroy upvars.
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/transform/simplify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ impl MirPass for SimplifyLocals {
}

/// Construct the mapping while swapping out unused stuff out from the `vec`.
fn make_local_map<'tcx, V>(
fn make_local_map<V>(
vec: &mut IndexVec<Local, V>,
mask: BitSet<Local>,
) -> IndexVec<Local, Option<Local>> {
Expand Down
26 changes: 13 additions & 13 deletions src/librustc_mir/util/elaborate_drops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
//
// FIXME: I think we should just control the flags externally,
// and then we do not need this machinery.
pub fn elaborate_drop<'a>(&mut self, bb: BasicBlock) {
pub fn elaborate_drop(&mut self, bb: BasicBlock) {
debug!("elaborate_drop({:?})", self);
let style = self.elaborator.drop_style(self.path, DropFlagMode::Deep);
debug!("elaborate_drop({:?}): live - {:?}", self, style);
Expand Down Expand Up @@ -285,7 +285,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
///
/// NOTE: this does not clear the master drop flag, so you need
/// to point succ/unwind on a `drop_ladder_bottom`.
fn drop_ladder<'a>(&mut self,
fn drop_ladder(&mut self,
fields: Vec<(Place<'tcx>, Option<D::Path>)>,
succ: BasicBlock,
unwind: Unwind)
Expand Down Expand Up @@ -314,7 +314,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
(*normal_ladder.last().unwrap(), *unwind_ladder.last().unwrap())
}

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

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

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

fn destructor_call_block<'a>(&mut self, (succ, unwind): (BasicBlock, Unwind))
fn destructor_call_block(&mut self, (succ, unwind): (BasicBlock, Unwind))
-> BasicBlock
{
debug!("destructor_call_block({:?}, {:?})", self, succ);
Expand Down Expand Up @@ -787,7 +787,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
///
/// This creates a "drop ladder" that drops the needed fields of the
/// ADT, both in the success case or if one of the destructors fail.
fn open_drop<'a>(&mut self) -> BasicBlock {
fn open_drop(&mut self) -> BasicBlock {
let ty = self.place_ty(self.place);
match ty.sty {
ty::Closure(def_id, substs) => {
Expand Down Expand Up @@ -837,7 +837,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
/// if FLAG(self.path)
/// if let Some(mode) = mode: FLAG(self.path)[mode] = false
/// drop(self.place)
fn complete_drop<'a>(&mut self,
fn complete_drop(&mut self,
drop_mode: Option<DropFlagMode>,
succ: BasicBlock,
unwind: Unwind) -> BasicBlock
Expand Down Expand Up @@ -867,7 +867,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
block
}

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

fn box_free_block<'a>(
fn box_free_block(
&mut self,
adt: &'tcx ty::AdtDef,
substs: SubstsRef<'tcx>,
Expand All @@ -887,7 +887,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
self.drop_flag_test_block(block, target, unwind)
}

fn unelaborated_free_block<'a>(
fn unelaborated_free_block(
&mut self,
adt: &'tcx ty::AdtDef,
substs: SubstsRef<'tcx>,
Expand Down Expand Up @@ -917,7 +917,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
free_block
}

fn drop_block<'a>(&mut self, target: BasicBlock, unwind: Unwind) -> BasicBlock {
fn drop_block(&mut self, target: BasicBlock, unwind: Unwind) -> BasicBlock {
let block = TerminatorKind::Drop {
location: self.place.clone(),
target,
Expand Down Expand Up @@ -947,7 +947,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
}
}

fn new_block<'a>(&mut self,
fn new_block(&mut self,
unwind: Unwind,
k: TerminatorKind<'tcx>)
-> BasicBlock
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/util/liveness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ pub enum DefUse {
Drop,
}

pub fn categorize<'tcx>(context: PlaceContext) -> Option<DefUse> {
pub fn categorize(context: PlaceContext) -> Option<DefUse> {
match context {
///////////////////////////////////////////////////////////////////////////
// DEFS
Expand Down

0 comments on commit d110d30

Please sign in to comment.