Add primary span label
This commit is contained in:
parent
6c7a5ba020
commit
b169cf1128
2 changed files with 6 additions and 4 deletions
|
|
@ -297,7 +297,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||
tcx.sess.diagnostic().struct_dummy()
|
||||
};
|
||||
|
||||
if let Some(def) = actual.ty_adt_def() {
|
||||
if let Some(def) = actual.ty_adt_def() {
|
||||
if let Some(full_sp) = tcx.hir.span_if_local(def.did) {
|
||||
let def_sp = tcx.sess.codemap().def_span(full_sp);
|
||||
err.span_label(def_sp, format!("{} `{}` not found {}",
|
||||
|
|
@ -380,6 +380,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||
if !static_sources.is_empty() {
|
||||
err.note("found the following associated functions; to be used as methods, \
|
||||
functions must have a `self` parameter");
|
||||
err.span_label(span, "this is an associated function, not a method");
|
||||
}
|
||||
if static_sources.len() == 1 {
|
||||
if let Some(expr) = rcvr_expr {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ error[E0599]: no method named `f9` found for type `usize` in the current scope
|
|||
--> $DIR/issue-7575.rs:74:18
|
||||
|
|
||||
LL | u.f8(42) + u.f9(342) + m.fff(42)
|
||||
| ^^
|
||||
| ^^ this is an associated function, not a method
|
||||
|
|
||||
= note: found the following associated functions; to be used as methods, functions must have a `self` parameter
|
||||
note: candidate #1 is defined in the trait `CtxtFn`
|
||||
|
|
@ -37,7 +37,8 @@ LL | struct Myisize(isize);
|
|||
...
|
||||
LL | u.f8(42) + u.f9(342) + m.fff(42)
|
||||
| --^^^
|
||||
| |
|
||||
| | |
|
||||
| | this is an associated function, not a method
|
||||
| help: use associated function syntax intead: `Myisize::fff`
|
||||
|
|
||||
= note: found the following associated functions; to be used as methods, functions must have a `self` parameter
|
||||
|
|
@ -51,7 +52,7 @@ error[E0599]: no method named `is_str` found for type `T` in the current scope
|
|||
--> $DIR/issue-7575.rs:82:7
|
||||
|
|
||||
LL | t.is_str()
|
||||
| ^^^^^^
|
||||
| ^^^^^^ this is an associated function, not a method
|
||||
|
|
||||
= note: found the following associated functions; to be used as methods, functions must have a `self` parameter
|
||||
note: the candidate is defined in the trait `ManyImplTrait`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue