Skip to content

Instantly share code, notes, and snippets.

@MarkJr94
Created December 29, 2014 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MarkJr94/6583667479b3b56ffde4 to your computer and use it in GitHub Desktop.
Save MarkJr94/6583667479b3b56ffde4 to your computer and use it in GitHub Desktop.
problems with using static vars to initialize arrays
test.rs:4:22: 4:25 error: expected constant integer for repeat count, found variable
test.rs:4 let arr = [0i, ..FOO];
^~~
error: aborting due to previous error
static FOO: uint = 32;
fn main() {
let arr = [0i, ..FOO];
for n in arr.iter() {
println!("n: {}", n);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment