1
Fork 0

Rename some compare_method functions

This commit is contained in:
Michael Goulet 2022-12-24 21:12:38 +00:00
parent 7e4f4660eb
commit 6161758b6d
6 changed files with 10 additions and 10 deletions

View file

@ -2,7 +2,7 @@ use crate::check::intrinsicck::InlineAsmCtxt;
use crate::errors::LinkageType; use crate::errors::LinkageType;
use super::compare_method::check_type_bounds; use super::compare_method::check_type_bounds;
use super::compare_method::{compare_impl_method, compare_ty_impl}; use super::compare_method::{compare_impl_method, compare_impl_ty};
use super::*; use super::*;
use rustc_attr as attr; use rustc_attr as attr;
use rustc_errors::{Applicability, ErrorGuaranteed, MultiSpan}; use rustc_errors::{Applicability, ErrorGuaranteed, MultiSpan};
@ -774,7 +774,7 @@ fn check_impl_items_against_trait<'tcx>(
let impl_item_full = tcx.hir().impl_item(impl_item.id); let impl_item_full = tcx.hir().impl_item(impl_item.id);
match impl_item_full.kind { match impl_item_full.kind {
hir::ImplItemKind::Const(..) => { hir::ImplItemKind::Const(..) => {
let _ = tcx.compare_assoc_const_impl_item_with_trait_item(( let _ = tcx.compare_impl_const((
impl_item.id.owner_id.def_id, impl_item.id.owner_id.def_id,
ty_impl_item.trait_item_def_id.unwrap(), ty_impl_item.trait_item_def_id.unwrap(),
)); ));
@ -791,7 +791,7 @@ fn check_impl_items_against_trait<'tcx>(
} }
hir::ImplItemKind::Type(impl_ty) => { hir::ImplItemKind::Type(impl_ty) => {
let opt_trait_span = tcx.hir().span_if_local(ty_trait_item.def_id); let opt_trait_span = tcx.hir().span_if_local(ty_trait_item.def_id);
compare_ty_impl( compare_impl_ty(
tcx, tcx,
&ty_impl_item, &ty_impl_item,
impl_ty.span, impl_ty.span,

View file

@ -1516,8 +1516,8 @@ fn compare_generic_param_kinds<'tcx>(
Ok(()) Ok(())
} }
/// Use `tcx.compare_assoc_const_impl_item_with_trait_item` instead /// Use `tcx.compare_impl_const` instead
pub(crate) fn raw_compare_const_impl( pub(crate) fn compare_impl_const_raw(
tcx: TyCtxt<'_>, tcx: TyCtxt<'_>,
(impl_const_item_def, trait_const_item_def): (LocalDefId, DefId), (impl_const_item_def, trait_const_item_def): (LocalDefId, DefId),
) -> Result<(), ErrorGuaranteed> { ) -> Result<(), ErrorGuaranteed> {
@ -1623,7 +1623,7 @@ pub(crate) fn raw_compare_const_impl(
Ok(()) Ok(())
} }
pub(crate) fn compare_ty_impl<'tcx>( pub(crate) fn compare_impl_ty<'tcx>(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
impl_ty: &ty::AssocItem, impl_ty: &ty::AssocItem,
impl_ty_span: Span, impl_ty_span: Span,

View file

@ -104,7 +104,7 @@ pub fn provide(providers: &mut Providers) {
check_mod_item_types, check_mod_item_types,
region_scope_tree, region_scope_tree,
collect_trait_impl_trait_tys, collect_trait_impl_trait_tys,
compare_assoc_const_impl_item_with_trait_item: compare_method::raw_compare_const_impl, compare_impl_const: compare_method::compare_impl_const_raw,
..*providers ..*providers
}; };
} }

View file

@ -1836,7 +1836,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
// In some (most?) cases cause.body_id points to actual body, but in some cases // In some (most?) cases cause.body_id points to actual body, but in some cases
// it's an actual definition. According to the comments (e.g. in // it's an actual definition. According to the comments (e.g. in
// rustc_hir_analysis/check/compare_method.rs:compare_predicate_entailment) the latter // rustc_hir_analysis/check/compare_method.rs:compare_method_predicate_entailment) the latter
// is relied upon by some other code. This might (or might not) need cleanup. // is relied upon by some other code. This might (or might not) need cleanup.
let body_owner_def_id = let body_owner_def_id =
self.tcx.hir().opt_local_def_id(cause.body_id).unwrap_or_else(|| { self.tcx.hir().opt_local_def_id(cause.body_id).unwrap_or_else(|| {

View file

@ -2117,7 +2117,7 @@ rustc_queries! {
desc { "checking to see if `{}` permits being left zeroed", key.ty } desc { "checking to see if `{}` permits being left zeroed", key.ty }
} }
query compare_assoc_const_impl_item_with_trait_item( query compare_impl_const(
key: (LocalDefId, DefId) key: (LocalDefId, DefId)
) -> Result<(), ErrorGuaranteed> { ) -> Result<(), ErrorGuaranteed> {
desc { |tcx| "checking assoc const `{}` has the same type as trait item", tcx.def_path_str(key.0.to_def_id()) } desc { |tcx| "checking assoc const `{}` has the same type as trait item", tcx.def_path_str(key.0.to_def_id()) }

View file

@ -194,7 +194,7 @@ fn resolve_associated_item<'tcx>(
&& trait_item_id != leaf_def.item.def_id && trait_item_id != leaf_def.item.def_id
&& let Some(leaf_def_item) = leaf_def.item.def_id.as_local() && let Some(leaf_def_item) = leaf_def.item.def_id.as_local()
{ {
tcx.compare_assoc_const_impl_item_with_trait_item(( tcx.compare_impl_const((
leaf_def_item, leaf_def_item,
trait_item_id, trait_item_id,
))?; ))?;