Open
Description
I tried this code:
use std::sync::Mutex;
use lazy_static::lazy_static;
const ROWS: usize = 100000;
const COLS: usize = 10000;
lazy_static! {
static ref TWODARRAY: Mutex<[[u128; COLS]; ROWS]> = Mutex::new([[0; COLS]; ROWS]);
}
fn main() {
let mut twodarray = TWODARRAY.lock().unwrap();
}
I expected it to compile successfully.
Instead, the compiler spent all available RAM and swap, and I had to kill it. From top
:
26208 hniksic 20 0 0.102t 7.939g 86392 S 96.8 58.0 0:04.78 rustc
Meta
rustc --version --verbose
:
rustc 1.58.1 (db9d1b20b 2022-01-20)
binary: rustc
commit-hash: db9d1b20bba1968c1ec1fc49616d4742c1725b4b
commit-date: 2022-01-20
host: x86_64-unknown-linux-gnu
release: 1.58.1
LLVM version: 13.0.0