g> for X {
    fn foo(&self) -> String { String::new() }
}
```
- add a trait bound to `T` and call a method on that trait that returns `Self`:
```
impl<T: std::default::Default> Trait<T> for X {
    fn foo(&self) -> T { <T as std::default::Default>::default() }
}
```
- change `foo` to return an argument of type `T`:
```
impl<T> Trait<T> for X {
    fn foo(&self, x: T) -> T { x }
}
```expected this type parameterevery closure has a distinct type and so could not always match the caller-chosen type of parameter `consider constraining the associated type `` to `for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.htmlyou can box the `` to coerce it to `Box<>`, but you'll have to change the expected type as well` implements `` so you could box the found value and coerce it to the trait object `Box<dyn >`, you will have to change the expected type as well