Created
July 26, 2013 07:49
-
-
Save ende76/6087033 to your computer and use it in GitHub Desktop.
This examples throws an error at compile time: does_not_fulfill_static.rs:5:32: 5:44 error: cannot capture variable of type `&[u8]`, which does not fulfill `'static`, in a bounded closure
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
use std::vec; | |
fn closure_with_captured_variables(target_bytes: &[u8], prefix: &[u8]) -> @fn(&[u8]) -> ~[u8] { | |
|bytes| { | |
vec::append(bytes.to_owned(), target_bytes) | |
} | |
} | |
fn main() { | |
println(fmt!("%?", closure_with_captured_variables([125u8, 65u8], []))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment