Clean up E0120 long explanation

This commit is contained in:
Guillaume Gomez 2019-12-19 13:45:28 +01:00
parent 19bd934676
commit 020be74f6b

View File

@ -1,5 +1,7 @@
An attempt was made to implement Drop on a trait, which is not allowed: only
structs and enums can implement Drop. An example causing this error:
The Drop was implemented on a trait, which is not allowed: only structs and
enums can implement Drop.
Erroneous code example:
```compile_fail,E0120
trait MyTrait {}
@ -10,7 +12,7 @@ impl Drop for MyTrait {
```
A workaround for this problem is to wrap the trait up in a struct, and implement
Drop on that. An example is shown below:
Drop on that:
```
trait MyTrait {}
@ -22,7 +24,7 @@ impl <T: MyTrait> Drop for MyWrapper<T> {
```
Alternatively, wrapping trait objects requires something like the following:
Alternatively, wrapping trait objects requires something:
```
trait MyTrait {}