Skip to content

Does Not Work Well With Generic Types #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
brunoczim opened this issue Jan 10, 2020 · 1 comment
Open

Does Not Work Well With Generic Types #2

brunoczim opened this issue Jan 10, 2020 · 1 comment

Comments

@brunoczim
Copy link

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
Copy link
Owner

nvzqz commented Jan 10, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants