1
Fork 0

Rollup merge of #139510 - nnethercote:name-to-ident, r=fee1-dead

Rename some `name` variables as `ident`.

It bugs me when variables of type `Ident` are called `name`. It leads to silly things like `name.name`. `Ident` variables should be called `ident`, and `name` should be used for variables of type `Symbol`.

This commit improves things by by doing `s/name/ident/` on a bunch of `Ident` variables. Not all of them, but a decent chunk.

r? `@fee1-dead`
This commit is contained in:
Matthias Krüger 2025-04-10 17:27:14 +02:00 committed by GitHub
commit 79f357e63d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
52 changed files with 241 additions and 229 deletions

View file

@ -1313,7 +1313,7 @@ impl<'a> CrateMetadataRef<'a> {
fn get_fn_has_self_parameter(self, id: DefIndex, sess: &'a Session) -> bool {
self.root
.tables
.fn_arg_names
.fn_arg_idents
.get(self, id)
.expect("argument names not encoded for a function")
.decode((self, sess))

View file

@ -286,7 +286,7 @@ provide! { tcx, def_id, other, cdata,
rendered_const => { table }
rendered_precise_capturing_args => { table }
asyncness => { table_direct }
fn_arg_names => { table }
fn_arg_idents => { table }
coroutine_kind => { table_direct }
coroutine_for_closure => { table }
coroutine_by_move_body_def_id => { table }

View file

@ -1469,7 +1469,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
}
if let DefKind::Fn | DefKind::AssocFn = def_kind {
self.tables.asyncness.set_some(def_id.index, tcx.asyncness(def_id));
record_array!(self.tables.fn_arg_names[def_id] <- tcx.fn_arg_names(def_id));
record_array!(self.tables.fn_arg_idents[def_id] <- tcx.fn_arg_idents(def_id));
}
if let Some(name) = tcx.intrinsic(def_id) {
record!(self.tables.intrinsic[def_id] <- name);

View file

@ -451,7 +451,7 @@ define_tables! {
rendered_const: Table<DefIndex, LazyValue<String>>,
rendered_precise_capturing_args: Table<DefIndex, LazyArray<PreciseCapturingArgKind<Symbol, Symbol>>>,
asyncness: Table<DefIndex, ty::Asyncness>,
fn_arg_names: Table<DefIndex, LazyArray<Option<Ident>>>,
fn_arg_idents: Table<DefIndex, LazyArray<Option<Ident>>>,
coroutine_kind: Table<DefIndex, hir::CoroutineKind>,
coroutine_for_closure: Table<DefIndex, RawDefId>,
adt_destructor: Table<DefIndex, LazyValue<ty::Destructor>>,