Remove DefId from AssocItemContainer.
This commit is contained in:
parent
8ee4446ee5
commit
d7ea161b7e
40 changed files with 190 additions and 220 deletions
|
@ -4,7 +4,7 @@ use rustc_data_structures::graph::iterate::{
|
|||
use rustc_hir::def::DefKind;
|
||||
use rustc_middle::mir::{BasicBlock, BasicBlocks, Body, Operand, TerminatorKind};
|
||||
use rustc_middle::ty::subst::{GenericArg, InternalSubsts};
|
||||
use rustc_middle::ty::{self, AssocItem, AssocItemContainer, Instance, TyCtxt};
|
||||
use rustc_middle::ty::{self, Instance, TyCtxt};
|
||||
use rustc_session::lint::builtin::UNCONDITIONAL_RECURSION;
|
||||
use rustc_span::Span;
|
||||
use std::ops::ControlFlow;
|
||||
|
@ -14,11 +14,9 @@ pub(crate) fn check<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tcx>) {
|
|||
|
||||
if let DefKind::Fn | DefKind::AssocFn = tcx.def_kind(def_id) {
|
||||
// If this is trait/impl method, extract the trait's substs.
|
||||
let trait_substs = match tcx.opt_associated_item(def_id.to_def_id()) {
|
||||
Some(AssocItem {
|
||||
container: AssocItemContainer::TraitContainer(trait_def_id), ..
|
||||
}) => {
|
||||
let trait_substs_count = tcx.generics_of(*trait_def_id).count();
|
||||
let trait_substs = match tcx.trait_of_item(def_id) {
|
||||
Some(trait_def_id) => {
|
||||
let trait_substs_count = tcx.generics_of(trait_def_id).count();
|
||||
&InternalSubsts::identity_for_item(tcx, def_id.to_def_id())[..trait_substs_count]
|
||||
}
|
||||
_ => &[],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue