Rollup merge of #130294 - nnethercote:more-lifetimes, r=lcnr
Lifetime cleanups The last commit is very opinionated, let's see how we go. r? `@oli-obk`
This commit is contained in:
commit
03e8b6bbfa
49 changed files with 224 additions and 231 deletions
|
@ -62,14 +62,14 @@ impl<'tcx> crate::MirPass<'tcx> for CheckAlignment {
|
|||
}
|
||||
}
|
||||
|
||||
struct PointerFinder<'tcx, 'a> {
|
||||
struct PointerFinder<'a, 'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
local_decls: &'a mut LocalDecls<'tcx>,
|
||||
param_env: ParamEnv<'tcx>,
|
||||
pointers: Vec<(Place<'tcx>, Ty<'tcx>)>,
|
||||
}
|
||||
|
||||
impl<'tcx, 'a> Visitor<'tcx> for PointerFinder<'tcx, 'a> {
|
||||
impl<'a, 'tcx> Visitor<'tcx> for PointerFinder<'a, 'tcx> {
|
||||
fn visit_place(&mut self, place: &Place<'tcx>, context: PlaceContext, location: Location) {
|
||||
// We want to only check reads and writes to Places, so we specifically exclude
|
||||
// Borrow and RawBorrow.
|
||||
|
|
|
@ -554,13 +554,13 @@ impl<'tcx> Patch<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
struct Collector<'tcx, 'locals> {
|
||||
struct Collector<'a, 'tcx> {
|
||||
patch: Patch<'tcx>,
|
||||
local_decls: &'locals LocalDecls<'tcx>,
|
||||
local_decls: &'a LocalDecls<'tcx>,
|
||||
}
|
||||
|
||||
impl<'tcx, 'locals> Collector<'tcx, 'locals> {
|
||||
pub(crate) fn new(tcx: TyCtxt<'tcx>, local_decls: &'locals LocalDecls<'tcx>) -> Self {
|
||||
impl<'a, 'tcx> Collector<'a, 'tcx> {
|
||||
pub(crate) fn new(tcx: TyCtxt<'tcx>, local_decls: &'a LocalDecls<'tcx>) -> Self {
|
||||
Self { patch: Patch::new(tcx), local_decls }
|
||||
}
|
||||
|
||||
|
@ -722,7 +722,7 @@ fn try_write_constant<'tcx>(
|
|||
|
||||
impl<'mir, 'tcx>
|
||||
ResultsVisitor<'mir, 'tcx, Results<'tcx, ValueAnalysisWrapper<ConstAnalysis<'_, 'tcx>>>>
|
||||
for Collector<'tcx, '_>
|
||||
for Collector<'_, 'tcx>
|
||||
{
|
||||
type Domain = State<FlatSet<Scalar>>;
|
||||
|
||||
|
@ -839,9 +839,9 @@ impl<'tcx> MutVisitor<'tcx> for Patch<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
struct OperandCollector<'a, 'locals, 'tcx> {
|
||||
struct OperandCollector<'a, 'b, 'tcx> {
|
||||
state: &'a State<FlatSet<Scalar>>,
|
||||
visitor: &'a mut Collector<'tcx, 'locals>,
|
||||
visitor: &'a mut Collector<'b, 'tcx>,
|
||||
ecx: &'a mut InterpCx<'tcx, DummyMachine>,
|
||||
map: &'a Map<'tcx>,
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ fn find_duplicates(body: &Body<'_>) -> FxHashMap<BasicBlock, BasicBlock> {
|
|||
duplicates
|
||||
}
|
||||
|
||||
struct BasicBlockHashable<'tcx, 'a> {
|
||||
struct BasicBlockHashable<'a, 'tcx> {
|
||||
basic_block_data: &'a BasicBlockData<'tcx>,
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ pub(super) fn build_projection<'tcx>(
|
|||
]
|
||||
}
|
||||
|
||||
struct ElaborateBoxDerefVisitor<'tcx, 'a> {
|
||||
struct ElaborateBoxDerefVisitor<'a, 'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
unique_did: DefId,
|
||||
nonnull_did: DefId,
|
||||
|
@ -46,7 +46,7 @@ struct ElaborateBoxDerefVisitor<'tcx, 'a> {
|
|||
patch: MirPatch<'tcx>,
|
||||
}
|
||||
|
||||
impl<'tcx, 'a> MutVisitor<'tcx> for ElaborateBoxDerefVisitor<'tcx, 'a> {
|
||||
impl<'a, 'tcx> MutVisitor<'tcx> for ElaborateBoxDerefVisitor<'a, 'tcx> {
|
||||
fn tcx(&self) -> TyCtxt<'tcx> {
|
||||
self.tcx
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ pub(crate) struct FnItemRef {
|
|||
pub ident: String,
|
||||
}
|
||||
|
||||
pub(crate) struct MustNotSupend<'tcx, 'a> {
|
||||
pub(crate) struct MustNotSupend<'a, 'tcx> {
|
||||
pub tcx: TyCtxt<'tcx>,
|
||||
pub yield_sp: Span,
|
||||
pub reason: Option<MustNotSuspendReason>,
|
||||
|
|
|
@ -63,13 +63,13 @@ impl<'tcx> crate::MirPass<'tcx> for InstSimplify {
|
|||
}
|
||||
}
|
||||
|
||||
struct InstSimplifyContext<'tcx, 'a> {
|
||||
struct InstSimplifyContext<'a, 'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
local_decls: &'a LocalDecls<'tcx>,
|
||||
param_env: ParamEnv<'tcx>,
|
||||
}
|
||||
|
||||
impl<'tcx> InstSimplifyContext<'tcx, '_> {
|
||||
impl<'tcx> InstSimplifyContext<'_, 'tcx> {
|
||||
fn should_simplify(&self, source_info: &SourceInfo, rvalue: &Rvalue<'tcx>) -> bool {
|
||||
self.should_simplify_custom(source_info, "Rvalue", rvalue)
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ struct ThreadingOpportunity {
|
|||
target: BasicBlock,
|
||||
}
|
||||
|
||||
struct TOFinder<'tcx, 'a> {
|
||||
struct TOFinder<'a, 'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
ecx: InterpCx<'tcx, DummyMachine>,
|
||||
|
@ -183,7 +183,7 @@ impl<'a> ConditionSet<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx, 'a> TOFinder<'tcx, 'a> {
|
||||
impl<'a, 'tcx> TOFinder<'a, 'tcx> {
|
||||
fn is_empty(&self, state: &State<ConditionSet<'a>>) -> bool {
|
||||
state.all_bottom()
|
||||
}
|
||||
|
|
|
@ -295,7 +295,7 @@ struct SimplifyToExp {
|
|||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
enum ExpectedTransformKind<'tcx, 'a> {
|
||||
enum ExpectedTransformKind<'a, 'tcx> {
|
||||
/// Identical statements.
|
||||
Same(&'a StatementKind<'tcx>),
|
||||
/// Assignment statements have the same value.
|
||||
|
|
|
@ -235,7 +235,7 @@ impl SsaLocals {
|
|||
}
|
||||
}
|
||||
|
||||
struct SsaVisitor<'tcx, 'a> {
|
||||
struct SsaVisitor<'a, 'tcx> {
|
||||
body: &'a Body<'tcx>,
|
||||
dominators: &'a Dominators<BasicBlock>,
|
||||
assignments: IndexVec<Local, Set1<DefLocation>>,
|
||||
|
@ -261,7 +261,7 @@ impl SsaVisitor<'_, '_> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx> Visitor<'tcx> for SsaVisitor<'tcx, '_> {
|
||||
impl<'tcx> Visitor<'tcx> for SsaVisitor<'_, 'tcx> {
|
||||
fn visit_local(&mut self, local: Local, ctxt: PlaceContext, loc: Location) {
|
||||
match ctxt {
|
||||
PlaceContext::MutatingUse(MutatingUseContext::Projection)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue