|
| 1 | +error[E0599]: the function or associated item `default` exists for associated type `<T as Bop>::Bar`, but its trait bounds were not satisfied |
| 2 | + --> $DIR/assoc_type_bounds_sized_used.rs:12:30 |
| 3 | + | |
| 4 | +LL | let _ = <T as Bop>::Bar::default(); |
| 5 | + | ^^^^^^^ function or associated item cannot be called on `<T as Bop>::Bar` due to unsatisfied trait bounds |
| 6 | + | |
| 7 | + = note: the following trait bounds were not satisfied: |
| 8 | + `T: Sized` |
| 9 | + which is required by `<T as Bop>::Bar: Default` |
| 10 | +help: consider restricting the type parameter to satisfy the trait bound |
| 11 | + | |
| 12 | +LL | fn bop<T: Bop + ?Sized>() where T: Sized { |
| 13 | + | ++++++++++++++ |
| 14 | + |
| 15 | +error[E0277]: the size for values of type `T` cannot be known at compilation time |
| 16 | + --> $DIR/assoc_type_bounds_sized_used.rs:12:13 |
| 17 | + | |
| 18 | +LL | fn bop<T: Bop + ?Sized>() { |
| 19 | + | - this type parameter needs to be `Sized` |
| 20 | +LL | let _ = <T as Bop>::Bar::default(); |
| 21 | + | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time |
| 22 | + | |
| 23 | +note: required by a bound in `Bop::Bar` |
| 24 | + --> $DIR/assoc_type_bounds_sized_used.rs:8:15 |
| 25 | + | |
| 26 | +LL | type Bar: Default |
| 27 | + | --- required by a bound in this associated type |
| 28 | +LL | where |
| 29 | +LL | Self: Sized; |
| 30 | + | ^^^^^ required by this bound in `Bop::Bar` |
| 31 | +help: consider removing the `?Sized` bound to make the type parameter `Sized` |
| 32 | + | |
| 33 | +LL - fn bop<T: Bop + ?Sized>() { |
| 34 | +LL + fn bop<T: Bop>() { |
| 35 | + | |
| 36 | + |
| 37 | +error[E0277]: the size for values of type `dyn Bop` cannot be known at compilation time |
| 38 | + --> $DIR/assoc_type_bounds_sized_used.rs:18:11 |
| 39 | + | |
| 40 | +LL | bop::<dyn Bop>(); |
| 41 | + | ^^^^^^^ doesn't have a size known at compile-time |
| 42 | + | |
| 43 | + = help: the trait `Sized` is not implemented for `dyn Bop` |
| 44 | +note: required by a bound in `bop` |
| 45 | + --> $DIR/assoc_type_bounds_sized_used.rs:11:11 |
| 46 | + | |
| 47 | +LL | fn bop<T: Bop + ?Sized>() { |
| 48 | + | ^^^ required by this bound in `bop` |
| 49 | + |
| 50 | +error: aborting due to 3 previous errors |
| 51 | + |
| 52 | +Some errors have detailed explanations: E0277, E0599. |
| 53 | +For more information about an error, try `rustc --explain E0277`. |
0 commit comments