1
Fork 0

Address review comments.

This commit is contained in:
Nicholas Nethercote 2025-04-10 09:39:21 +10:00
parent 1b3fc585cb
commit 663a317c20
6 changed files with 11 additions and 8 deletions

View file

@ -1436,7 +1436,7 @@ rustc_queries! {
}
query fn_arg_idents(def_id: DefId) -> &'tcx [Option<rustc_span::Ident>] {
desc { |tcx| "looking up function parameter idents for `{}`", tcx.def_path_str(def_id) }
desc { |tcx| "looking up function parameter identifiers for `{}`", tcx.def_path_str(def_id) }
separate_provide_extern
}

View file

@ -199,7 +199,8 @@ impl AssocItems {
self.items.get_by_key(name)
}
/// Returns the associated item with the given ident and `AssocKind`, if one exists.
/// Returns the associated item with the given identifier and `AssocKind`, if one exists.
/// The identifier is matched hygienically.
pub fn find_by_ident_and_kind(
&self,
tcx: TyCtxt<'_>,
@ -212,7 +213,8 @@ impl AssocItems {
.find(|item| tcx.hygienic_eq(ident, item.ident(tcx), parent_def_id))
}
/// Returns the associated item with the given ident and any of `AssocKind`, if one exists.
/// Returns the associated item with the given identifier and any of `AssocKind`, if one
/// exists. The identifier is matched hygienically.
pub fn find_by_ident_and_kinds(
&self,
tcx: TyCtxt<'_>,
@ -224,7 +226,8 @@ impl AssocItems {
kinds.iter().find_map(|kind| self.find_by_ident_and_kind(tcx, ident, *kind, parent_def_id))
}
/// Returns the associated item with the given ident in the given `Namespace`, if one exists.
/// Returns the associated item with the given identifier in the given `Namespace`, if one
/// exists. The identifier is matched hygienically.
pub fn find_by_ident_and_namespace(
&self,
tcx: TyCtxt<'_>,

View file

@ -1940,7 +1940,7 @@ impl<'tcx> TyCtxt<'tcx> {
/// its supposed definition name (`def_name`). The method also needs `DefId` of the supposed
/// definition's parent/scope to perform comparison.
pub fn hygienic_eq(self, use_ident: Ident, def_ident: Ident, def_parent_def_id: DefId) -> bool {
// We could use `Ident::eq` here, but we deliberately don't. The ident
// We could use `Ident::eq` here, but we deliberately don't. The identifier
// comparison fails frequently, and we want to avoid the expensive
// `normalize_to_macros_2_0()` calls required for the span comparison whenever possible.
use_ident.name == def_ident.name