Created
June 23, 2013 19:06
-
-
Save dcolish/5846147 to your computer and use it in GitHub Desktop.
This file contains 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
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