Rename module compare_method -> compare_impl_item
This commit is contained in:
parent
91613c5030
commit
c7b414adb6
4 changed files with 15 additions and 15 deletions
|
@ -1,8 +1,8 @@
|
|||
use crate::check::intrinsicck::InlineAsmCtxt;
|
||||
use crate::errors::LinkageType;
|
||||
|
||||
use super::compare_method::check_type_bounds;
|
||||
use super::compare_method::{compare_impl_method, compare_impl_ty};
|
||||
use super::compare_impl_item::check_type_bounds;
|
||||
use super::compare_impl_item::{compare_impl_method, compare_impl_ty};
|
||||
use super::*;
|
||||
use rustc_attr as attr;
|
||||
use rustc_errors::{Applicability, ErrorGuaranteed, MultiSpan};
|
||||
|
|
|
@ -71,7 +71,7 @@ pub(super) fn compare_impl_method<'tcx>(
|
|||
return;
|
||||
}
|
||||
|
||||
if let Err(_) = compare_predicate_entailment(
|
||||
if let Err(_) = compare_method_predicate_entailment(
|
||||
tcx,
|
||||
impl_m,
|
||||
impl_m_span,
|
||||
|
@ -150,7 +150,7 @@ pub(super) fn compare_impl_method<'tcx>(
|
|||
/// Finally we register each of these predicates as an obligation and check that
|
||||
/// they hold.
|
||||
#[instrument(level = "debug", skip(tcx, impl_m_span, impl_trait_ref))]
|
||||
fn compare_predicate_entailment<'tcx>(
|
||||
fn compare_method_predicate_entailment<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
impl_m: &ty::AssocItem,
|
||||
impl_m_span: Span,
|
||||
|
@ -337,7 +337,7 @@ fn compare_predicate_entailment<'tcx>(
|
|||
if !errors.is_empty() {
|
||||
match check_implied_wf {
|
||||
CheckImpliedWfMode::Check => {
|
||||
return compare_predicate_entailment(
|
||||
return compare_method_predicate_entailment(
|
||||
tcx,
|
||||
impl_m,
|
||||
impl_m_span,
|
||||
|
@ -374,7 +374,7 @@ fn compare_predicate_entailment<'tcx>(
|
|||
// becomes a hard error (i.e. ideally we'd just call `resolve_regions_and_report_errors`
|
||||
match check_implied_wf {
|
||||
CheckImpliedWfMode::Check => {
|
||||
return compare_predicate_entailment(
|
||||
return compare_method_predicate_entailment(
|
||||
tcx,
|
||||
impl_m,
|
||||
impl_m_span,
|
||||
|
@ -407,7 +407,7 @@ enum CheckImpliedWfMode {
|
|||
/// re-check with `Skip`, and emit a lint if it succeeds.
|
||||
Check,
|
||||
/// Skips checking implied well-formedness of the impl method, but will emit
|
||||
/// a lint if the `compare_predicate_entailment` succeeded. This means that
|
||||
/// a lint if the `compare_method_predicate_entailment` succeeded. This means that
|
||||
/// the reason that we had failed earlier during `Check` was due to the impl
|
||||
/// having stronger requirements than the trait.
|
||||
Skip,
|
||||
|
@ -550,13 +550,13 @@ pub(super) fn collect_trait_impl_trait_tys<'tcx>(
|
|||
// Unify the whole function signature. We need to do this to fully infer
|
||||
// the lifetimes of the return type, but do this after unifying just the
|
||||
// return types, since we want to avoid duplicating errors from
|
||||
// `compare_predicate_entailment`.
|
||||
// `compare_method_predicate_entailment`.
|
||||
match ocx.eq(&cause, param_env, trait_fty, impl_fty) {
|
||||
Ok(()) => {}
|
||||
Err(terr) => {
|
||||
// This function gets called during `compare_predicate_entailment` when normalizing a
|
||||
// This function gets called during `compare_method_predicate_entailment` when normalizing a
|
||||
// signature that contains RPITIT. When the method signatures don't match, we have to
|
||||
// emit an error now because `compare_predicate_entailment` will not report the error
|
||||
// emit an error now because `compare_method_predicate_entailment` will not report the error
|
||||
// when normalization fails.
|
||||
let emitted = report_trait_method_mismatch(
|
||||
infcx,
|
||||
|
@ -1645,7 +1645,7 @@ pub(super) fn compare_impl_ty<'tcx>(
|
|||
})();
|
||||
}
|
||||
|
||||
/// The equivalent of [compare_predicate_entailment], but for associated types
|
||||
/// The equivalent of [compare_method_predicate_entailment], but for associated types
|
||||
/// instead of associated functions.
|
||||
fn compare_type_predicate_entailment<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
|
@ -63,7 +63,7 @@ a type parameter).
|
|||
*/
|
||||
|
||||
mod check;
|
||||
mod compare_method;
|
||||
mod compare_impl_item;
|
||||
pub mod dropck;
|
||||
pub mod intrinsic;
|
||||
pub mod intrinsicck;
|
||||
|
@ -94,7 +94,7 @@ use std::num::NonZeroU32;
|
|||
use crate::require_c_abi_if_c_variadic;
|
||||
use crate::util::common::indenter;
|
||||
|
||||
use self::compare_method::collect_trait_impl_trait_tys;
|
||||
use self::compare_impl_item::collect_trait_impl_trait_tys;
|
||||
use self::region::region_scope_tree;
|
||||
|
||||
pub fn provide(providers: &mut Providers) {
|
||||
|
@ -104,7 +104,7 @@ pub fn provide(providers: &mut Providers) {
|
|||
check_mod_item_types,
|
||||
region_scope_tree,
|
||||
collect_trait_impl_trait_tys,
|
||||
compare_impl_const: compare_method::compare_impl_const_raw,
|
||||
compare_impl_const: compare_impl_item::compare_impl_const_raw,
|
||||
..*providers
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1836,7 +1836,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
|
||||
// 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
|
||||
// rustc_hir_analysis/check/compare_method.rs:compare_method_predicate_entailment) the latter
|
||||
// rustc_hir_analysis/check/compare_impl_item.rs:compare_predicate_entailment) the latter
|
||||
// is relied upon by some other code. This might (or might not) need cleanup.
|
||||
let body_owner_def_id =
|
||||
self.tcx.hir().opt_local_def_id(cause.body_id).unwrap_or_else(|| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue