Hey folks, I've started writing some rust code lately and run into weird
behavior when benchmarking. When running

https://gist.github.com/benwilson512/56f84ffffd4625f11feb

#[bench]
fn test_overflow(b: &mut Bencher) {
  let nums = [0i, ..1000000];
  b.iter(|| {
    let mut x = 0i;
    for i in range(0, nums.len()) {
      x = nums[i];
    }
  });
}

 I get "task '<main>' has overflowed its stack" pretty much
immediately when running cargo bench. Ordinarily I'd expect to see
that error when doing recursion, but I can't quite figure out why it's
showing up here. What am I missing?

Thanks!

- Ben
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to