Skip to content

Commit 4f16a26

Browse files
authored
Rollup merge of rust-lang#67017 - GuillaumeGomez:long-err-explanations-2, r=Dylan-DPC
cleanup long error explanations r? @Dylan-DPC
2 parents 75ffae6 + ae753a5 commit 4f16a26

File tree

5 files changed

+22
-12
lines changed

5 files changed

+22
-12
lines changed

src/librustc_error_codes/error_codes/E0109.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
You tried to provide a generic argument to a type which doesn't need it.
2+
23
Erroneous code example:
34

45
```compile_fail,E0109

src/librustc_error_codes/error_codes/E0116.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
You can only define an inherent implementation for a type in the same crate
2-
where the type was defined. For example, an `impl` block as below is not allowed
3-
since `Vec` is defined in the standard library:
1+
An inherent implementation was defined for a type outside the current crate.
2+
3+
Erroneous code example:
44

55
```compile_fail,E0116
66
impl Vec<u8> { } // error
77
```
88

9+
You can only define an inherent implementation for a type in the same crate
10+
where the type was defined. For example, an `impl` block as above is not allowed
11+
since `Vec` is defined in the standard library.
12+
913
To fix this problem, you can do either of these things:
1014

1115
- define a trait that has the desired associated functions/types/constants and

src/librustc_error_codes/error_codes/E0117.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
The `Drop` trait was implemented on a non-struct type.
2+
3+
Erroneous code example:
4+
5+
```compile_fail,E0117
6+
impl Drop for u32 {}
7+
```
8+
19
This error indicates a violation of one of Rust's orphan rules for trait
210
implementations. The rule prohibits any implementation of a foreign trait (a
311
trait defined in another crate) where
@@ -6,12 +14,6 @@ trait defined in another crate) where
614
- all of the parameters being passed to the trait (if there are any) are also
715
foreign.
816

9-
Here's one example of this error:
10-
11-
```compile_fail,E0117
12-
impl Drop for u32 {}
13-
```
14-
1517
To avoid this kind of error, ensure that at least one local type is referenced
1618
by the `impl`:
1719

src/librustc_error_codes/error_codes/E0118.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
You're trying to write an inherent implementation for something which isn't a
2-
struct nor an enum. Erroneous code example:
1+
An inherent implementation was defined for something which isn't a struct nor
2+
an enum.
3+
4+
Erroneous code example:
35

46
```compile_fail,E0118
57
impl (u8, u8) { // error: no base type found for inherent implementation

src/librustc_error_codes/error_codes/E0119.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
There are conflicting trait implementations for the same type.
2-
Example of erroneous code:
2+
3+
Erroneous code example:
34

45
```compile_fail,E0119
56
trait MyTrait {

0 commit comments

Comments
 (0)