Skip to content

Instantly share code, notes, and snippets.

@jroesch
Created January 3, 2015 10:37
Show Gist options
  • Save jroesch/672f6bd2893301e12a18 to your computer and use it in GitHub Desktop.
Save jroesch/672f6bd2893301e12a18 to your computer and use it in GitHub Desktop.
trait Foo<T> {
fn meth(&self) where T: Copy {}
}
impl<T> Foo<T> for int {
fn meth(&self) where T: Eq {}
}
fn main() {
Foo::<int>::meth(&1);
}
@jroesch
Copy link
Author

jroesch commented Jan 3, 2015

Error message:

test.rs:8:5: 8:34 error: the trait `core::cmp::Eq` is not implemented for the type `T`
test.rs:8     fn meth(&self) where T: Eq {}
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment