Skip to content

Instantly share code, notes, and snippets.

@dcolish
Created June 23, 2013 19:06
Show Gist options
  • Save dcolish/5846147 to your computer and use it in GitHub Desktop.
Save dcolish/5846147 to your computer and use it in GitHub Desktop.
fn main() {
let m: &fn() = foo(true);
println(fmt!("%?", m));
// m();
}
fn foo(x: bool) -> &fn(){
match x {
true => ||{ println("Hello") },
_ => {
fn bar() {
println("Hello")
}
}
}
}
// borrowing.rs:11:13: 15:9 error: mismatched types: expected `&fn()` but found `()` (expected fn but found ())
// borrowing.rs:11 _ => {
// borrowing.rs:12 fn bar() {
// borrowing.rs:13 println("Hello")
// borrowing.rs:14 }
// borrowing.rs:15 }
// error: aborting due to previous error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment