use super::{SelectionContext, Obligation, ObligationCause};
-use middle::cstore::LOCAL_CRATE;
-use hir::def_id::DefId;
-use ty::subst::TypeSpace;
+use hir::def_id::{DefId, LOCAL_CRATE};
use ty::{self, Ty, TyCtxt};
use infer::{InferCtxt, TypeOrigin};
use syntax_pos::DUMMY_SP;
// First, create an ordered iterator over all the type parameters to the trait, with the self
// type appearing first.
- let input_tys = Some(trait_ref.self_ty());
- let input_tys = input_tys.iter().chain(trait_ref.substs.types.get_slice(TypeSpace));
-
// Find the first input type that either references a type parameter OR
// some local type.
- for input_ty in input_tys {
+ for input_ty in trait_ref.input_types() {
if ty_is_local(tcx, input_ty, infer_is_local) {
debug!("orphan_check_trait_ref: ty_is_local `{:?}`", input_ty);
match ty.sty {
ty::TyBox(..) | ty::TyRef(..) =>
true,
- ty::TyEnum(def, _) | ty::TyStruct(def, _) =>
+ ty::TyAdt(def, _) =>
def.is_fundamental(),
ty::TyTrait(ref data) =>
- tcx.has_attr(data.principal_def_id(), "fundamental"),
+ tcx.has_attr(data.principal.def_id(), "fundamental"),
_ =>
false
}
infer_is_local.0
}
- ty::TyEnum(def, _) |
- ty::TyStruct(def, _) => {
+ ty::TyAdt(def, _) => {
def.did.is_local()
}
}
ty::TyTrait(ref tt) => {
- tt.principal_def_id().is_local()
+ tt.principal.def_id().is_local()
}
ty::TyError => {