use middle::ty::util::CopyImplementationError;
use middle::free_region::FreeRegionMap;
use CrateCtxt;
-use middle::infer::{self, InferCtxt, new_infer_ctxt};
+use middle::infer::{self, InferCtxt, TypeOrigin, new_infer_ctxt};
use std::cell::RefCell;
use std::rc::Rc;
use syntax::codemap::Span;
use util::nodemap::{DefIdMap, FnvHashMap};
use rustc::front::map as hir_map;
use rustc::front::map::NodeItem;
-use rustc_front::visit;
+use rustc_front::intravisit;
use rustc_front::hir::{Item, ItemImpl,Crate};
use rustc_front::hir;
}
TyBool | TyChar | TyInt(..) | TyUint(..) | TyFloat(..) |
- TyStr(..) | TyArray(..) | TySlice(..) | TyBareFn(..) | TyTuple(..) |
+ TyStr | TyArray(..) | TySlice(..) | TyBareFn(..) | TyTuple(..) |
TyParam(..) | TyError |
TyRawPtr(_) | TyRef(_, _) | TyProjection(..) => {
None
cc: &'a CoherenceChecker<'a, 'tcx>
}
-impl<'a, 'tcx, 'v> visit::Visitor<'v> for CoherenceCheckVisitor<'a, 'tcx> {
+impl<'a, 'tcx, 'v> intravisit::Visitor<'v> for CoherenceCheckVisitor<'a, 'tcx> {
fn visit_item(&mut self, item: &Item) {
if let ItemImpl(..) = item.node {
self.cc.check_implementation(item)
}
-
- visit::walk_item(self, item);
}
}
// Check implementations and traits. This populates the tables
// containing the inherent methods and extension methods. It also
// builds up the trait inheritance table.
- let mut visitor = CoherenceCheckVisitor { cc: self };
- visit::walk_crate(&mut visitor, krate);
+ krate.visit_all_items(&mut CoherenceCheckVisitor { cc: self });
// Copy over the inherent impls we gathered up during the walk into
// the tcx.
impl_items.iter().map(|impl_item| {
let impl_def_id = self.crate_context.tcx.map.local_def_id(impl_item.id);
match impl_item.node {
- hir::ConstImplItem(..) => {
+ hir::ImplItemKind::Const(..) => {
ConstTraitItemId(impl_def_id)
}
- hir::MethodImplItem(..) => {
+ hir::ImplItemKind::Method(..) => {
MethodTraitItemId(impl_def_id)
}
- hir::TypeImplItem(_) => {
+ hir::ImplItemKind::Type(_) => {
TypeTraitItemId(impl_def_id)
}
}
return;
}
- let origin = infer::Misc(span);
+ let origin = TypeOrigin::Misc(span);
let fields = &def_a.struct_variant().fields;
let diff_fields = fields.iter().enumerate().filter_map(|(i, f)| {
let (a, b) = (f.ty(tcx, substs_a), f.ty(tcx, substs_b));