Rollup merge of #67017 - GuillaumeGomez:long-err-explanations-2, r=Dylan-DPC

cleanup long error explanations

r? @Dylan-DPC
This commit is contained in:
Yuki Okushi 2019-12-06 15:37:08 +09:00 committed by GitHub
commit 662a225f1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 12 deletions

View File

@ -1,4 +1,5 @@
You tried to provide a generic argument to a type which doesn't need it.
Erroneous code example:
```compile_fail,E0109

View File

@ -1,11 +1,15 @@
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 below is not allowed
since `Vec` is defined in the standard library:
An inherent implementation was defined for a type outside the current crate.
Erroneous code example:
```compile_fail,E0116
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:
- define a trait that has the desired associated functions/types/constants and

View File

@ -1,3 +1,11 @@
The `Drop` trait was implemented on a non-struct type.
Erroneous code example:
```compile_fail,E0117
impl Drop for u32 {}
```
This error indicates a violation of one of Rust's orphan rules for trait
implementations. The rule prohibits any implementation of a foreign trait (a
trait defined in another crate) where
@ -6,12 +14,6 @@ trait defined in another crate) where
- all of the parameters being passed to the trait (if there are any) are also
foreign.
Here's one example of this error:
```compile_fail,E0117
impl Drop for u32 {}
```
To avoid this kind of error, ensure that at least one local type is referenced
by the `impl`:

View File

@ -1,5 +1,7 @@
You're trying to write an inherent implementation for something which isn't a
struct nor an enum. Erroneous code example:
An inherent implementation was defined for something which isn't a struct nor
an enum.
Erroneous code example:
```compile_fail,E0118
impl (u8, u8) { // error: no base type found for inherent implementation

View File

@ -1,5 +1,6 @@
There are conflicting trait implementations for the same type.
Example of erroneous code:
Erroneous code example:
```compile_fail,E0119
trait MyTrait {