nvzqz/impls

Does Not Work Well With Generic Types

brunoczim opened this issue · 1 comments

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.

nvzqz commented

This limitation is mentioned in "Generic Types". Without plugging into the compiler, this unfortunately is not possible.