Skip to content

Modified E0220 to show error messages for more general cases #34364

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

Merged
merged 1 commit into from
Jun 23, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions src/librustc_typeck/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2787,23 +2787,42 @@ You used an associated type which isn't defined in the trait.
Erroneous code example:

```compile_fail
trait Trait {
trait T1 {
type Bar;
}

type Foo = Trait<F=i32>; // error: associated type `F` not found for
// `Trait`
type Foo = T1<F=i32>; // error: associated type `F` not found for `T1`

// or:

trait T2 {
type Bar;

// error: Baz is used but not declared
fn return_bool(&self, &Self::Bar, &Self::Baz) -> bool;
}
```

Please verify you used the right trait or you didn't misspell the
Make sure that you have defined the associated type in the trait body.
Also, verify that you used the right trait or you didn't misspell the
associated type name. Example:

```
trait Trait {
trait T1 {
type Bar;
}

type Foo = Trait<Bar=i32>; // ok!
type Foo = T1<Bar=i32>; // ok!

// or:

trait T2 {
type Bar;
type Baz; // we declare `Baz` in our trait.

// and now we can use it here:
fn return_bool(&self, &Self::Bar, &Self::Baz) -> bool;
}
```
"##,

Expand Down