1
Fork 0

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:
Konrad Borowski 2019-10-08 12:19:00 +02:00 committed by GitHub
parent 1e1f25e31b
commit 58089717b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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!
}
```