Add ?Sized bound to a supertrait listing in E0038 error documentation
This example failed to compile because of implicit `Sized` bound for `A` parameter that wasn't required by `Trait`.
This commit is contained in:
parent
1e1f25e31b
commit
58089717b9
1 changed files with 4 additions and 4 deletions
|
@ -259,8 +259,8 @@ trait Foo {
|
|||
This is similar to the second sub-error, but subtler. It happens in situations
|
||||
like the following:
|
||||
|
||||
```compile_fail
|
||||
trait Super<A> {}
|
||||
```
|
||||
trait Super<A: ?Sized> {}
|
||||
|
||||
trait Trait: Super<Self> {
|
||||
}
|
||||
|
@ -275,8 +275,8 @@ impl Trait for Foo {}
|
|||
Here, the supertrait might have methods as follows:
|
||||
|
||||
```
|
||||
trait Super<A> {
|
||||
fn get_a(&self) -> A; // note that this is object safe!
|
||||
trait Super<A: ?Sized> {
|
||||
fn get_a(&self) -> &A; // note that this is object safe!
|
||||
}
|
||||
```
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue