Rename and reorder lots of lifetimes.
- Replace non-standard names like 's, 'p, 'rg, 'ck, 'parent, 'this, and 'me with vanilla 'a. These are cases where the original name isn't really any more informative than 'a. - Replace names like 'cx, 'mir, and 'body with vanilla 'a when the lifetime applies to multiple fields and so the original lifetime name isn't really accurate. - Put 'tcx last in lifetime lists, and 'a before 'b.
This commit is contained in:
parent
606b9cb406
commit
8d32578fe1
40 changed files with 169 additions and 170 deletions
|
@ -143,18 +143,18 @@ impl<'tcx> LateLintPass<'tcx> for TailExprDropOrder {
|
|||
}
|
||||
}
|
||||
|
||||
struct LintVisitor<'tcx, 'a> {
|
||||
struct LintVisitor<'a, 'tcx> {
|
||||
cx: &'a LateContext<'tcx>,
|
||||
// We only record locals that have significant drops
|
||||
locals: Vec<Span>,
|
||||
}
|
||||
|
||||
struct LocalCollector<'tcx, 'a> {
|
||||
struct LocalCollector<'a, 'tcx> {
|
||||
cx: &'a LateContext<'tcx>,
|
||||
locals: &'a mut Vec<Span>,
|
||||
}
|
||||
|
||||
impl<'tcx, 'a> Visitor<'tcx> for LocalCollector<'tcx, 'a> {
|
||||
impl<'a, 'tcx> Visitor<'tcx> for LocalCollector<'a, 'tcx> {
|
||||
type Result = ();
|
||||
fn visit_pat(&mut self, pat: &'tcx Pat<'tcx>) {
|
||||
if let PatKind::Binding(_binding_mode, id, ident, pat) = pat.kind {
|
||||
|
@ -171,7 +171,7 @@ impl<'tcx, 'a> Visitor<'tcx> for LocalCollector<'tcx, 'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx, 'a> Visitor<'tcx> for LintVisitor<'tcx, 'a> {
|
||||
impl<'a, 'tcx> Visitor<'tcx> for LintVisitor<'a, 'tcx> {
|
||||
fn visit_block(&mut self, block: &'tcx Block<'tcx>) {
|
||||
let mut locals = <_>::default();
|
||||
swap(&mut locals, &mut self.locals);
|
||||
|
@ -183,7 +183,7 @@ impl<'tcx, 'a> Visitor<'tcx> for LintVisitor<'tcx, 'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx, 'a> LintVisitor<'tcx, 'a> {
|
||||
impl<'a, 'tcx> LintVisitor<'a, 'tcx> {
|
||||
fn check_block_inner(&mut self, block: &Block<'tcx>) {
|
||||
if !block.span.at_least_rust_2024() {
|
||||
// We only lint for Edition 2024 onwards
|
||||
|
@ -205,13 +205,13 @@ impl<'tcx, 'a> LintVisitor<'tcx, 'a> {
|
|||
}
|
||||
}
|
||||
|
||||
struct LintTailExpr<'tcx, 'a> {
|
||||
struct LintTailExpr<'a, 'tcx> {
|
||||
cx: &'a LateContext<'tcx>,
|
||||
is_root_tail_expr: bool,
|
||||
locals: &'a [Span],
|
||||
}
|
||||
|
||||
impl<'tcx, 'a> LintTailExpr<'tcx, 'a> {
|
||||
impl<'a, 'tcx> LintTailExpr<'a, 'tcx> {
|
||||
fn expr_eventually_point_into_local(mut expr: &Expr<'tcx>) -> bool {
|
||||
loop {
|
||||
match expr.kind {
|
||||
|
@ -239,7 +239,7 @@ impl<'tcx, 'a> LintTailExpr<'tcx, 'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx, 'a> Visitor<'tcx> for LintTailExpr<'tcx, 'a> {
|
||||
impl<'a, 'tcx> Visitor<'tcx> for LintTailExpr<'a, 'tcx> {
|
||||
fn visit_expr(&mut self, expr: &'tcx Expr<'tcx>) {
|
||||
if self.is_root_tail_expr {
|
||||
self.is_root_tail_expr = false;
|
||||
|
|
|
@ -1713,13 +1713,13 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
|
|||
hir_ty: &hir::Ty<'tcx>,
|
||||
ty: Ty<'tcx>,
|
||||
) -> Vec<(Ty<'tcx>, Span)> {
|
||||
struct FnPtrFinder<'parent, 'a, 'tcx> {
|
||||
visitor: &'parent ImproperCTypesVisitor<'a, 'tcx>,
|
||||
struct FnPtrFinder<'a, 'b, 'tcx> {
|
||||
visitor: &'a ImproperCTypesVisitor<'b, 'tcx>,
|
||||
spans: Vec<Span>,
|
||||
tys: Vec<Ty<'tcx>>,
|
||||
}
|
||||
|
||||
impl<'parent, 'a, 'tcx> hir::intravisit::Visitor<'_> for FnPtrFinder<'parent, 'a, 'tcx> {
|
||||
impl<'a, 'b, 'tcx> hir::intravisit::Visitor<'_> for FnPtrFinder<'a, 'b, 'tcx> {
|
||||
fn visit_ty(&mut self, ty: &'_ hir::Ty<'_>) {
|
||||
debug!(?ty);
|
||||
if let hir::TyKind::BareFn(hir::BareFnTy { abi, .. }) = ty.kind
|
||||
|
@ -1732,7 +1732,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'vis, 'a, 'tcx> ty::visit::TypeVisitor<TyCtxt<'tcx>> for FnPtrFinder<'vis, 'a, 'tcx> {
|
||||
impl<'a, 'b, 'tcx> ty::visit::TypeVisitor<TyCtxt<'tcx>> for FnPtrFinder<'a, 'b, 'tcx> {
|
||||
type Result = ControlFlow<Ty<'tcx>>;
|
||||
|
||||
fn visit_ty(&mut self, ty: Ty<'tcx>) -> Self::Result {
|
||||
|
@ -1746,7 +1746,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
let mut visitor = FnPtrFinder { visitor: &*self, spans: Vec::new(), tys: Vec::new() };
|
||||
let mut visitor = FnPtrFinder { visitor: self, spans: Vec::new(), tys: Vec::new() };
|
||||
ty.visit_with(&mut visitor);
|
||||
hir::intravisit::Visitor::visit_ty(&mut visitor, hir_ty);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue