mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-15 05:26:47 +00:00
Address review comments.
This commit is contained in:
parent
1b3fc585cb
commit
663a317c20
@ -2500,7 +2500,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
|
||||
);
|
||||
let ty::Tuple(params) = tupled_params.kind() else { return };
|
||||
|
||||
// Find the first argument with a matching type, get its ident
|
||||
// Find the first argument with a matching type and get its identifier.
|
||||
let Some(this_name) = params.iter().zip(tcx.hir_body_param_idents(closure.body)).find_map(
|
||||
|(param_ty, ident)| {
|
||||
// FIXME: also support deref for stuff like `Rc` arguments
|
||||
|
@ -1169,7 +1169,7 @@ trait InvocationCollectorNode: HasAttrs + HasNodeId + Sized {
|
||||
collector.cx.dcx().emit_err(RemoveNodeNotSupported { span, descr: Self::descr() });
|
||||
}
|
||||
|
||||
/// All of the idents (items) declared by this node.
|
||||
/// All of the identifiers (items) declared by this node.
|
||||
/// This is an approximation and should only be used for diagnostics.
|
||||
fn declared_idents(&self) -> Vec<Ident> {
|
||||
vec![]
|
||||
|
@ -3399,7 +3399,7 @@ pub struct BareFnTy<'hir> {
|
||||
pub abi: ExternAbi,
|
||||
pub generic_params: &'hir [GenericParam<'hir>],
|
||||
pub decl: &'hir FnDecl<'hir>,
|
||||
// `Option` because bare fn parameter idents are optional. We also end up
|
||||
// `Option` because bare fn parameter identifiers are optional. We also end up
|
||||
// with `None` in some error cases, e.g. invalid parameter patterns.
|
||||
pub param_idents: &'hir [Option<Ident>],
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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<'_>,
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user