small error code explanations improvements
This commit is contained in:
parent
9bb2e3cd34
commit
a8de11cdd5
2 changed files with 3 additions and 3 deletions
|
|
@ -24,4 +24,4 @@ dereferencing the pointer.
|
|||
You can read more about trait objects in the [Trait Objects] section of the
|
||||
Reference.
|
||||
|
||||
[Trait Objects]: https://doc.rust-lang.org/reference/types.html#trait-objects
|
||||
[Trait Objects]: https://doc.rust-lang.org/reference/types.html#trait-objects
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ cause this problem.)
|
|||
In such a case, the compiler cannot predict the return type of `foo()` in a
|
||||
situation like the following:
|
||||
|
||||
```compile_fail
|
||||
```compile_fail,E0038
|
||||
trait Trait {
|
||||
fn foo(&self) -> Self;
|
||||
}
|
||||
|
|
@ -183,7 +183,7 @@ fn call_foo(thing: Box<Trait>) {
|
|||
|
||||
We don't just need to create a table of all implementations of all methods of
|
||||
`Trait`, we need to create such a table, for each different type fed to
|
||||
`foo()`. In this case this turns out to be (10 types implementing `Trait`)*(3
|
||||
`foo()`. In this case this turns out to be (10 types implementing `Trait`)\*(3
|
||||
types being fed to `foo()`) = 30 implementations!
|
||||
|
||||
With real world traits these numbers can grow drastically.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue