Clean up E0116 error code long explanation
This commit is contained in:
parent
5f1d6c4403
commit
c2ce7dd756
1 changed files with 7 additions and 3 deletions
|
@ -1,11 +1,15 @@
|
||||||
You can only define an inherent implementation for a type in the same crate
|
An inherent implementation was defined for a type outside the current crate.
|
||||||
where the type was defined. For example, an `impl` block as below is not allowed
|
|
||||||
since `Vec` is defined in the standard library:
|
Erroneous code example:
|
||||||
|
|
||||||
```compile_fail,E0116
|
```compile_fail,E0116
|
||||||
impl Vec<u8> { } // error
|
impl Vec<u8> { } // error
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You can only define an inherent implementation for a type in the same crate
|
||||||
|
where the type was defined. For example, an `impl` block as above is not allowed
|
||||||
|
since `Vec` is defined in the standard library.
|
||||||
|
|
||||||
To fix this problem, you can do either of these things:
|
To fix this problem, you can do either of these things:
|
||||||
|
|
||||||
- define a trait that has the desired associated functions/types/constants and
|
- define a trait that has the desired associated functions/types/constants and
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue