Point at the Sized obligation in where clauses

This commit is contained in:
Esteban Küber 2020-01-29 13:27:53 -08:00
parent 4b2f1db6e4
commit 972ae5afe5
3 changed files with 41 additions and 7 deletions

View file

@ -1,10 +1,11 @@
error[E0038]: the trait `Bar` cannot be made into an object
--> $DIR/object-safety-sized-2.rs:14:30
|
LL | where Self : Sized
| ----- the trait cannot require that `Self : Sized`
...
LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
| ^^^^^^^^ the trait `Bar` cannot be made into an object
|
= note: the trait cannot require that `Self : Sized`
error: aborting due to previous error

View file

@ -1,10 +1,12 @@
error[E0038]: the trait `Bar` cannot be made into an object
--> $DIR/object-safety-sized-2.rs:16:5
|
LL | where Self : Sized
| ----- the trait cannot require that `Self : Sized`
...
LL | t
| ^ the trait `Bar` cannot be made into an object
|
= note: the trait cannot require that `Self : Sized`
= note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&dyn Bar>` for `&T`
= note: required by cast to type `&dyn Bar`