fix "X is not a member of trait Y" span labels

The span labels for associated types and consts were hardcoded to `Foo`
rather than substituting the name of the trait.

This also normalizes the wording for associated methods', traits', and
consts' span labels.

Fixes #36428.
This commit is contained in:
Alex Burka 2016-09-12 17:47:59 -04:00 committed by Alex Burka
parent 5531c314a2
commit 0a62676c73
3 changed files with 7 additions and 7 deletions

View File

@ -247,7 +247,7 @@ fn resolve_struct_error<'b, 'a: 'b, 'c>(resolver: &'b Resolver<'a>,
"method `{}` is not a member of trait `{}`",
method,
trait_);
err.span_label(span, &format!("not a member of `{}`", trait_));
err.span_label(span, &format!("not a member of trait `{}`", trait_));
err
}
ResolutionError::TypeNotMemberOfTrait(type_, trait_) => {
@ -257,7 +257,7 @@ fn resolve_struct_error<'b, 'a: 'b, 'c>(resolver: &'b Resolver<'a>,
"type `{}` is not a member of trait `{}`",
type_,
trait_);
err.span_label(span, &format!("not a member of trait `Foo`"));
err.span_label(span, &format!("not a member of trait `{}`", trait_));
err
}
ResolutionError::ConstNotMemberOfTrait(const_, trait_) => {
@ -267,7 +267,7 @@ fn resolve_struct_error<'b, 'a: 'b, 'c>(resolver: &'b Resolver<'a>,
"const `{}` is not a member of trait `{}`",
const_,
trait_);
err.span_label(span, &format!("not a member of trait `Foo`"));
err.span_label(span, &format!("not a member of trait `{}`", trait_));
err
}
ResolutionError::VariableNotBoundInPattern(variable_name, from, to) => {

View File

@ -18,7 +18,7 @@ impl Foo for Bar {
fn a() {}
fn b() {}
//~^ ERROR E0407
//~| NOTE not a member of `Foo`
//~| NOTE not a member of trait `Foo`
}
fn main() {

View File

@ -10,11 +10,11 @@
#![feature(associated_consts)]
trait Foo {}
trait Bar {}
impl Foo for i32 {
impl Bar for i32 {
const BAR: bool = true; //~ ERROR E0438
//~| NOTE not a member of trait `Foo`
//~| NOTE not a member of trait `Bar`
}
fn main () {