Skip to content

Commit

Permalink
fix "X is not a member of trait Y" span labels
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
durka authored and Alex Burka committed Sep 13, 2016
1 parent 5531c31 commit 0a62676
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/librustc_resolve/lib.rs
Expand Up @@ -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_) => {
Expand All @@ -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_) => {
Expand All @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/E0407.rs
Expand Up @@ -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() {
Expand Down
6 changes: 3 additions & 3 deletions src/test/compile-fail/E0438.rs
Expand Up @@ -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 () {
Expand Down

0 comments on commit 0a62676

Please sign in to comment.