use CrateCtxt;
use middle::cstore::LOCAL_CRATE;
-use middle::def::Def;
-use middle::def_id::DefId;
-use middle::infer;
-use middle::ty::{self, LvaluePreference, Ty};
+use hir::def::Def;
+use hir::def_id::DefId;
+use rustc::infer;
+use rustc::ty::{self, LvaluePreference, Ty};
use syntax::codemap::Span;
use syntax::parse::token;
use syntax::ptr::P;
-use rustc_front::hir;
+use rustc::hir;
/// Check that it is legal to call methods of the trait corresponding
/// to `trait_id` (this only cares about the trait, not the specific
autoderef(fcx,
callee_expr.span,
original_callee_ty,
- Some(callee_expr),
+ || Some(callee_expr),
UnresolvedTypeAction::Error,
LvaluePreference::NoPreference,
|adj_ty, idx| {
// If the callee is a bare function or a closure, then we're all set.
match structurally_resolved_type(fcx, callee_expr.span, adjusted_ty).sty {
- ty::TyBareFn(..) => {
+ ty::TyFnDef(..) | ty::TyFnPtr(_) => {
fcx.write_autoderef_adjustment(callee_expr.id, autoderefs);
return Some(CallStep::Builtin);
}
let error_fn_sig;
let fn_sig = match callee_ty.sty {
- ty::TyBareFn(_, &ty::BareFnTy {ref sig, ..}) => {
+ ty::TyFnDef(_, _, &ty::BareFnTy {ref sig, ..}) |
+ ty::TyFnPtr(&ty::BareFnTy {ref sig, ..}) => {
sig
}
_ => {
write_overloaded_call_method_map(fcx, self.call_expr, method_callee);
}
None => {
- fcx.tcx().sess.span_bug(
+ span_bug!(
self.call_expr.span,
"failed to find an overloaded call trait for closure call");
}