1
Fork 0

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:
Nicholas Nethercote 2024-09-12 09:25:11 +10:00
parent 606b9cb406
commit 8d32578fe1
40 changed files with 169 additions and 170 deletions

View file

@ -134,13 +134,12 @@ fn parse_attribute(attr: &Attribute) -> MirPhase {
MirPhase::parse(dialect, phase)
}
struct ParseCtxt<'tcx, 'body> {
struct ParseCtxt<'a, 'tcx> {
tcx: TyCtxt<'tcx>,
param_env: ParamEnv<'tcx>,
thir: &'body Thir<'tcx>,
thir: &'a Thir<'tcx>,
source_scope: SourceScope,
body: &'body mut Body<'tcx>,
body: &'a mut Body<'tcx>,
local_map: FxHashMap<LocalVarId, Local>,
block_map: FxHashMap<LocalVarId, BasicBlock>,
}
@ -151,7 +150,7 @@ struct ParseError {
expected: String,
}
impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
impl<'a, 'tcx> ParseCtxt<'a, 'tcx> {
fn expr_error(&self, expr: ExprId, expected: &'static str) -> ParseError {
let expr = &self.thir[expr];
ParseError {

View file

@ -68,7 +68,7 @@ macro_rules! parse_by_kind {
}
pub(crate) use parse_by_kind;
impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
impl<'a, 'tcx> ParseCtxt<'a, 'tcx> {
/// Expressions should only ever be matched on after preparsing them. This removes extra scopes
/// we don't care about.
fn preparse(&self, expr_id: ExprId) -> ExprId {

View file

@ -12,7 +12,7 @@ use super::{parse_by_kind, PResult, ParseCtxt};
use crate::build::custom::ParseError;
use crate::build::expr::as_constant::as_constant_inner;
impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
impl<'a, 'tcx> ParseCtxt<'a, 'tcx> {
pub(crate) fn parse_statement(&self, expr_id: ExprId) -> PResult<StatementKind<'tcx>> {
parse_by_kind!(self, expr_id, _, "statement",
@call(mir_storage_live, args) => {