Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not a member of trait Foo error label in trait impl of different name for associated types #36428

Closed
nagisa opened this issue Sep 12, 2016 · 1 comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@nagisa
Copy link
Member

nagisa commented Sep 12, 2016

trait Peach {}

impl Peach for bool { 
    type Banana = ();
}

results in

error[E0437]: type `Banana` is not a member of trait `Peach`
 --> <anon>:5:5
  |
5 |     type Banana = ();
  |     ^^^^^^^^^^^^^^^^^ not a member of trait `Foo`

cc @jonathandturner

@durka
Copy link
Contributor

durka commented Sep 12, 2016

d'oh

ResolutionError::TypeNotMemberOfTrait(type_, trait_) => {
let mut err = struct_span_err!(resolver.session,
span,
E0437,
"type `{}` is not a member of trait `{}`",
type_,
trait_);
err.span_label(span, &format!("not a member of trait `Foo`"));
err
}
ResolutionError::ConstNotMemberOfTrait(const_, trait_) => {
let mut err = struct_span_err!(resolver.session,
span,
E0438,
"const `{}` is not a member of trait `{}`",
const_,
trait_);
err.span_label(span, &format!("not a member of trait `Foo`"));
err
}

durka added a commit to durka/rust that referenced this issue Sep 13, 2016
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 rust-lang#36428.
@apasel422 apasel422 added the A-diagnostics Area: Messages for errors, warnings, and lints label Sep 13, 2016
Manishearth added a commit to Manishearth/rust that referenced this issue Sep 15, 2016
fix "X is not a member of trait Y" span labels

Fixes rust-lang#36428.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints
Projects
None yet
Development

No branches or pull requests

3 participants