commit
77c995b96a
2 changed files with 28 additions and 0 deletions
|
|
@ -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.
|
||||
|
|
|
|||
17
src/test/compile-fail/issue-10969.rs
Normal file
17
src/test/compile-fail/issue-10969.rs
Normal 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`
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue