2022-07-11 05:20:37 +00:00
error[E0277]: the size for values of type `dyn ToString` cannot be known at compilation time
2023-08-26 19:25:46 +00:00
--> $DIR/issue-61525.rs:14:19
2022-07-11 05:20:37 +00:00
|
LL | 1.query::<dyn ToString>("")
2023-08-26 19:25:46 +00:00
| ----- ^^^^^^^^^^^^ doesn't have a size known at compile-time
2022-07-11 05:20:37 +00:00
| |
| required by a bound introduced by this call
|
= help: the trait `Sized` is not implemented for `dyn ToString`
2024-01-24 21:29:15 +00:00
note: required by an implicit `Sized` bound in `Example::query`
2022-07-11 05:20:37 +00:00
--> $DIR/issue-61525.rs:2:14
|
LL | fn query<Q>(self, q: Q);
2024-01-30 19:47:45 +00:00
| ^ required by the implicit `Sized` requirement on this type parameter in `Example::query`
2022-07-11 05:20:37 +00:00
help: consider relaxing the implicit `Sized` restriction
|
LL | fn query<Q: ?Sized>(self, q: Q);
| ++++++++
error[E0308]: mismatched types
--> $DIR/issue-61525.rs:14:33
|
LL | 1.query::<dyn ToString>("")
2023-01-02 18:00:33 -08:00
| --------------------- ^^ expected `dyn ToString`, found `&str`
2022-07-11 05:20:37 +00:00
| |
2023-01-05 03:02:10 +00:00
| arguments to this method are incorrect
2022-07-11 05:20:37 +00:00
|
= note: expected trait object `dyn ToString`
found reference `&'static str`
2024-01-24 16:30:37 +00:00
= help: `&'static str` implements `ToString` so you could box the found value and coerce it to the trait object `Box<dyn ToString>`, you will have to change the expected type as well
2023-02-21 14:11:08 -07:00
note: method defined here
2022-07-11 05:20:37 +00:00
--> $DIR/issue-61525.rs:2:8
|
LL | fn query<Q>(self, q: Q);
2025-02-03 11:19:17 -05:00
| ^^^^^ -
2022-07-11 05:20:37 +00:00
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.