Last active
August 29, 2015 14:21
-
-
Save emk/a05bdbfe9b71582a39f6 to your computer and use it in GitHub Desktop.
Implementing traits for function types?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Based on: | |
// https://github.com/emk/jit.rs/blob/master/src/macros.rs#L41-L64 | |
// https://github.com/emk/jit.rs/blob/master/src/compile.rs#L105-L109 | |
// https://github.com/emk/jit.rs/blob/master/examples/hello_world.rs#L22 | |
// Build on branch: | |
// https://github.com/emk/jit.rs/tree/rust-beta-updates | |
trait Foo {} | |
impl Foo for fn() {} | |
fn do_foo<T: Foo>(t: T) {} | |
fn example() {} | |
fn main() { | |
do_foo(example); | |
} | |
# fn_impl.rs:10:5: 10:11 error: the trait `Foo` is not implemented for the type `fn() {example}` [E0277] | |
# fn_impl.rs:10 do_foo(example); | |
# ^~~~~~ | |
# error: aborting due to previous error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment