Skip to content

Commit

Permalink
clean E0271 explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Feb 5, 2020
1 parent 320ada6 commit c182461
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/librustc_error_codes/error_codes/E0271.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
This is because of a type mismatch between the associated type of some
trait (e.g., `T::Bar`, where `T` implements `trait Quux { type Bar; }`)
and another type `U` that is required to be equal to `T::Bar`, but is not.
Examples follow.
A type mismatched an associated type of a trait.

Here is a basic example:
Erroneous code example:

```compile_fail,E0271
trait Trait { type AssociatedType; }
Expand All @@ -17,6 +14,11 @@ impl Trait for i8 { type AssociatedType = &'static str; }
foo(3_i8);
```

This is because of a type mismatch between the associated type of some
trait (e.g., `T::Bar`, where `T` implements `trait Quux { type Bar; }`)
and another type `U` that is required to be equal to `T::Bar`, but is not.
Examples follow.

Here is that same example again, with some explanatory comments:

```compile_fail,E0271
Expand Down

0 comments on commit c182461

Please sign in to comment.