pub trait Example {
fn query<Q>(self, q: Q);
}
impl Example for i32 {
fn query<Q>(self, _: Q) {
unimplemented!()
}
}
mod nested {
use super::Example;
fn example() {
1.query::<dyn ToString>("")
}
}
error: the `query` method cannot be invoked on a trait object
--> src/lib.rs:14:11
|
14 | 1.query::<dyn ToString>("")
| ^^^^^
|
= note: another candidate was found in the following trait, perhaps add a `use` for it:
`use crate::Example;`
Issues with this diagnostic:
- The
query method is not being invoked on a trait object; it's invoked on the concrete value 1.
- The note suggests importing the same trait that is already being reported about.
Issues with this diagnostic:
querymethod is not being invoked on a trait object; it's invoked on the concrete value1.