rustc_mir: deny(unused_lifetimes).
This commit is contained in:
parent
7dc34945e4
commit
d110d309b6
13 changed files with 27 additions and 26 deletions
|
@ -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,
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
|
@ -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>],
|
||||
|
|
|
@ -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>,
|
||||
|
|
|
@ -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,
|
||||
|
@ -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,
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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>> {
|
||||
|
|
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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 {
|
||||
|
@ -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);
|
||||
|
@ -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) => {
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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>,
|
||||
|
@ -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>,
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue