Skip to content

Commit

Permalink
Rollup merge of rust-lang#67017 - GuillaumeGomez:long-err-explanation…
Browse files Browse the repository at this point in the history
…s-2, r=Dylan-DPC

cleanup long error explanations

r? @Dylan-DPC
  • Loading branch information
JohnTitor authored Dec 5, 2019
2 parents 08a7eb8 + ae753a5 commit dd2706d
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/librustc_error_codes/error_codes/E0109.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 7 additions & 3 deletions src/librustc_error_codes/error_codes/E0116.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
14 changes: 8 additions & 6 deletions src/librustc_error_codes/error_codes/E0117.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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`:

Expand Down
6 changes: 4 additions & 2 deletions src/librustc_error_codes/error_codes/E0118.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/librustc_error_codes/error_codes/E0119.md
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down

0 comments on commit dd2706d

Please sign in to comment.