impls
impls copied to clipboard
Does Not Work Well With Generic Types
Considers this example:
use impls::impls;
use std::fs::File;
fn impls_clone<T>() -> bool {
impls!(T: Clone)
}
fn main() {
// false (wrong!)
println!("{:?}", impls_clone::<String>());
// false (right)
println!("{:?}", impls_clone::<File>());
}
It says that String does not implements Clone, which is wrong (I mean, String does implement Clone). I am not sure if this possible to be fixed though.
This limitation is mentioned in "Generic Types". Without plugging into the compiler, this unfortunately is not possible.