Rollup merge of #68869 - GuillaumeGomez:err-explanation-e0271, r=Dylan-DPC

clean up E0271 explanation

r? @Dylan-DPC
This commit is contained in:
Dylan DPC 2020-02-06 15:37:49 +01:00 committed by GitHub
commit 2210d3f356
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 5 deletions

View File

@ -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; }
@ -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