这段代码给我报错了:
fn main() {
let x = [0 as u64; std::u64::MAX as usize];
println!("Hello, world! {}", std::u64::MAX);
}
error: the type `[u64; 18446744073709551615]` is too big for the current architecture
--> src/main.rs:2:9
|
2 | let x = [0 as u64; std::u64::MAX as usize];
| ^
u64
)。您将永远无法分配您尝试的那么多内存,即使您使用(例如)一个Vec
将其放在堆上。 - Peter HallVec
。 - Coder-256