-
- Notifications
You must be signed in to change notification settings - Fork 14.2k
Open
Labels
A-arrayArea: `[T; N]`Area: `[T; N]`C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
I tried this code:
let mut drv = Vec::<[[f64; 512]; 512]>::new(); drv.resize(4, [[0.0; 512]; 512]);Only in Debug.
I expected to see this happen:
Not crash. I'd be ok with an assert or something.
Instead, this happened:
thread 'main' has overflowed its stack fatal runtime error: stack overflow, aborting zsh: IOT instruction (core dumped) cargo run Meta
rustc --version --verbose:
rustc 1.89.0 (29483883e 2025-08-04) binary: rustc commit-hash: 29483883eed69d5fb4db01964cdf2af4d86e9cb2 commit-date: 2025-08-04 host: x86_64-unknown-linux-gnu release: 1.89.0 LLVM version: 20.1.7 Playground link
(updated, it was the wrong version)
Using vec![] instead of the Vec::new() and resize() cause the same error. (see Playground)
Happens with nightly
rustc 1.91.0-nightly (fe5536432 2025-08-29) (from rustc 1.91.0-nightly (809200ec9 2025-08-24)) Backtrace
No more info with RUST_BACKTRACE=1
With GDB
Program received signal SIGSEGV, Segmentation fault. 0x0000555555559d51 in alloc::vec::Vec<[[f64; 512]; 512], alloc::alloc::Global>::extend_with<[[f64; 512]; 512], alloc::alloc::Global> ( self=0x0, n=0, value=...) at /var/home/hub/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs:3191 3191 fn extend_with(&mut self, n: usize, value: T) { (gdb) where #0 0x0000555555559d51 in alloc::vec::Vec<[[f64; 512]; 512], alloc::alloc::Global>::extend_with<[[f64; 512]; 512], alloc::alloc::Global> ( self=0x0, n=0, value=...) at /var/home/hub/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs:3191 #1 0x000055555555a10d in alloc::vec::Vec<[[f64; 512]; 512], alloc::alloc::Global>::resize<[[f64; 512]; 512], alloc::alloc::Global> ( self=0x7fffffdfcca8, new_len=4, value=<error reading variable: value requires 2097152 bytes, which is more than max-value-size>) at /var/home/hub/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs:3071 #2 0x000055555555a336 in test_rust::main () at src/main.rs:10 Metadata
Metadata
Assignees
Labels
A-arrayArea: `[T; N]`Area: `[T; N]`C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.