Auto merge of #30001 - Detegr:master, r=Manishearth

r? @Manishearth
This commit is contained in:
bors 2015-11-24 01:42:31 +00:00
commit 77c995b96a
2 changed files with 28 additions and 0 deletions

View file

@ -231,6 +231,17 @@ fn confirm_builtin_call<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
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.

View file

@ -0,0 +1,17 @@
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn func(i: i32) { //~NOTE defined here
i(); //~ERROR expected function, found `i32`
}
fn main() {
let i = 0i32; //~NOTE defined here
i(); //~ERROR expected function, found `i32`
}