ty::KContainer -> ty::AssocItemContainer::K

This commit is contained in:
Michael Goulet 2024-11-03 21:47:56 +00:00
parent f0cf9969cb
commit b14362f665
2 changed files with 5 additions and 5 deletions

View File

@ -2,6 +2,7 @@
use rustc_ast::ast; use rustc_ast::ast;
use rustc_hir as hir; use rustc_hir as hir;
use rustc_lint::{LateContext, LateLintPass, LintContext}; use rustc_lint::{LateContext, LateLintPass, LintContext};
use rustc_middle::ty::AssocItemContainer;
use rustc_session::declare_lint_pass; use rustc_session::declare_lint_pass;
use rustc_span::{Span, sym}; use rustc_span::{Span, sym};
@ -138,7 +139,6 @@ fn check_item(&mut self, cx: &LateContext<'tcx>, it: &'tcx hir::Item<'_>) {
} }
fn check_impl_item(&mut self, cx: &LateContext<'tcx>, impl_item: &'tcx hir::ImplItem<'_>) { fn check_impl_item(&mut self, cx: &LateContext<'tcx>, impl_item: &'tcx hir::ImplItem<'_>) {
use rustc_middle::ty::{ImplContainer, TraitContainer};
if rustc_middle::lint::in_external_macro(cx.sess(), impl_item.span) || is_executable_or_proc_macro(cx) { if rustc_middle::lint::in_external_macro(cx.sess(), impl_item.span) || is_executable_or_proc_macro(cx) {
return; return;
} }
@ -156,8 +156,8 @@ fn check_impl_item(&mut self, cx: &LateContext<'tcx>, impl_item: &'tcx hir::Impl
let assoc_item = cx.tcx.associated_item(impl_item.owner_id); let assoc_item = cx.tcx.associated_item(impl_item.owner_id);
let container_id = assoc_item.container_id(cx.tcx); let container_id = assoc_item.container_id(cx.tcx);
let trait_def_id = match assoc_item.container { let trait_def_id = match assoc_item.container {
TraitContainer => Some(container_id), AssocItemContainer::Trait => Some(container_id),
ImplContainer => cx.tcx.impl_trait_ref(container_id).map(|t| t.skip_binder().def_id), AssocItemContainer::Impl => cx.tcx.impl_trait_ref(container_id).map(|t| t.skip_binder().def_id),
}; };
if let Some(trait_def_id) = trait_def_id { if let Some(trait_def_id) = trait_def_id {

View File

@ -3340,8 +3340,8 @@ pub fn get_path_from_caller_to_method_type<'tcx>(
let assoc_item = tcx.associated_item(method); let assoc_item = tcx.associated_item(method);
let def_id = assoc_item.container_id(tcx); let def_id = assoc_item.container_id(tcx);
match assoc_item.container { match assoc_item.container {
rustc_ty::TraitContainer => get_path_to_callee(tcx, from, def_id), rustc_ty::AssocItemContainer::Trait => get_path_to_callee(tcx, from, def_id),
rustc_ty::ImplContainer => { rustc_ty::AssocItemContainer::Impl => {
let ty = tcx.type_of(def_id).instantiate_identity(); let ty = tcx.type_of(def_id).instantiate_identity();
get_path_to_ty(tcx, from, ty, args) get_path_to_ty(tcx, from, ty, args)
}, },