use super::Expectation;
use super::expected_types_for_fn_args;
use super::FnCtxt;
-use super::LvaluePreference;
use super::method;
use super::structurally_resolved_type;
use super::TupleArgumentsFlag;
use super::write_call;
use CrateCtxt;
-use middle::def_id::{DefId, LOCAL_CRATE};
+use middle::cstore::LOCAL_CRATE;
+use middle::def_id::DefId;
use middle::infer;
-use middle::ty::{self, Ty};
-use syntax::ast;
+use middle::ty::{self, LvaluePreference, Ty};
use syntax::codemap::Span;
use syntax::parse::token;
use syntax::ptr::P;
+use rustc_front::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
/// method that is called)
}
pub fn check_call<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
- call_expr: &'tcx ast::Expr,
- callee_expr: &'tcx ast::Expr,
- arg_exprs: &'tcx [P<ast::Expr>],
+ call_expr: &'tcx hir::Expr,
+ callee_expr: &'tcx hir::Expr,
+ arg_exprs: &'tcx [P<hir::Expr>],
expected: Expectation<'tcx>)
{
check_expr(fcx, callee_expr);
}
fn try_overloaded_call_step<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
- call_expr: &'tcx ast::Expr,
- callee_expr: &'tcx ast::Expr,
+ call_expr: &'tcx hir::Expr,
+ callee_expr: &'tcx hir::Expr,
adjusted_ty: Ty<'tcx>,
autoderefs: usize)
-> Option<CallStep<'tcx>>
}
fn try_overloaded_call_traits<'a,'tcx>(fcx: &FnCtxt<'a, 'tcx>,
- call_expr: &ast::Expr,
- callee_expr: &ast::Expr,
+ call_expr: &hir::Expr,
+ callee_expr: &hir::Expr,
adjusted_ty: Ty<'tcx>,
autoderefs: usize)
-> Option<ty::MethodCallee<'tcx>>
}
fn confirm_builtin_call<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
- call_expr: &ast::Expr,
+ call_expr: &hir::Expr,
callee_ty: Ty<'tcx>,
- arg_exprs: &'tcx [P<ast::Expr>],
+ arg_exprs: &'tcx [P<hir::Expr>],
expected: Expectation<'tcx>)
{
let error_fn_sig;
format!("expected function, found `{}`", actual)
}, callee_ty, None);
+ if let hir::ExprCall(ref expr, _) = call_expr.node {
+ let tcx = fcx.tcx();
+ if let Some(pr) = tcx.def_map.borrow().get(&expr.id) {
+ if pr.depth == 0 {
+ if let Some(span) = tcx.map.span_if_local(pr.def_id()) {
+ tcx.sess.span_note(span, "defined here")
+ }
+ }
+ }
+ }
+
// This is the "default" function signature, used in case of error.
// In that case, we check each argument against "error" in order to
// set up all the node type bindings.
}
fn confirm_deferred_closure_call<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
- call_expr: &ast::Expr,
- arg_exprs: &'tcx [P<ast::Expr>],
+ call_expr: &hir::Expr,
+ arg_exprs: &'tcx [P<hir::Expr>],
expected: Expectation<'tcx>,
fn_sig: ty::FnSig<'tcx>)
{
}
fn confirm_overloaded_call<'a,'tcx>(fcx: &FnCtxt<'a, 'tcx>,
- call_expr: &ast::Expr,
- callee_expr: &'tcx ast::Expr,
- arg_exprs: &'tcx [P<ast::Expr>],
+ call_expr: &hir::Expr,
+ callee_expr: &'tcx hir::Expr,
+ arg_exprs: &'tcx [P<hir::Expr>],
expected: Expectation<'tcx>,
method_callee: ty::MethodCallee<'tcx>)
{
}
fn write_overloaded_call_method_map<'a,'tcx>(fcx: &FnCtxt<'a, 'tcx>,
- call_expr: &ast::Expr,
+ call_expr: &hir::Expr,
method_callee: ty::MethodCallee<'tcx>) {
let method_call = ty::MethodCall::expr(call_expr.id);
fcx.inh.tables.borrow_mut().method_map.insert(method_call, method_callee);
#[derive(Debug)]
struct CallResolution<'tcx> {
- call_expr: &'tcx ast::Expr,
- callee_expr: &'tcx ast::Expr,
+ call_expr: &'tcx hir::Expr,
+ callee_expr: &'tcx hir::Expr,
adjusted_ty: Ty<'tcx>,
autoderefs: usize,
fn_sig: ty::FnSig<'tcx>,