title: How many elements can a Rust array have?
body: <p>This code gave me an error:</p>
  
  <pre><code>fn main() {
      let x = [0 as u64; std::u64::MAX as usize];
      println!("Hello, world! {}", std::u64::MAX);
  }
  </code></pre>
  
  <pre class="lang-none prettyprint-override"><code>error: the type `[u64; 18446744073709551615]` is too big for the current architecture
   --&gt; src/main.rs:2:9
    |
  2 |     let x = [0 as u64; std::u64::MAX as usize];
    |         ^
  </code></pre>