summaryrefslogtreecommitdiffstats
path: root/tests/ui/object-safety/assoc_type_bounds_sized_used.stderr
blob: b67a1244eceab1f7dc58c62f20b16a6817d4677f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
error[E0599]: the function or associated item `default` exists for associated type `<T as Bop>::Bar`, but its trait bounds were not satisfied
  --> $DIR/assoc_type_bounds_sized_used.rs:11:30
   |
LL |     let _ = <T as Bop>::Bar::default();
   |                              ^^^^^^^ function or associated item cannot be called on `<T as Bop>::Bar` due to unsatisfied trait bounds
   |
   = note: the following trait bounds were not satisfied:
           `T: Sized`
           which is required by `<T as Bop>::Bar: Default`
help: consider restricting the type parameter to satisfy the trait bound
   |
LL | fn bop<T: Bop + ?Sized>() where T: Sized {
   |                           ++++++++++++++

error[E0277]: the size for values of type `T` cannot be known at compilation time
  --> $DIR/assoc_type_bounds_sized_used.rs:11:14
   |
LL | fn bop<T: Bop + ?Sized>() {
   |        - this type parameter needs to be `Sized`
LL |     let _ = <T as Bop>::Bar::default();
   |              ^ doesn't have a size known at compile-time
   |
note: required by a bound in `Bop::Bar`
  --> $DIR/assoc_type_bounds_sized_used.rs:7:15
   |
LL |     type Bar: Default
   |          --- required by a bound in this associated type
LL |     where
LL |         Self: Sized;
   |               ^^^^^ required by this bound in `Bop::Bar`
help: consider removing the `?Sized` bound to make the type parameter `Sized`
   |
LL - fn bop<T: Bop + ?Sized>() {
LL + fn bop<T: Bop>() {
   |
help: consider relaxing the implicit `Sized` restriction
   |
LL |     type Bar: Default + ?Sized
   |                       ++++++++

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0277, E0599.
For more information about an error, try `rustc --explain E0277`.