Closed
Description
I tried this code:
enum Foo<T: 'static> {
Value(T),
Recursive(&'static Foo<Option<T>>),
}
fn main() {
let _x = Foo::Value(());
}
I expected to see this happen: rustc refuses to compile this enum and tell me this (definition) does not work
Instead, this happened: rustc overflows its stack and the compile process ends abruptly
Meta
rustc --version --verbose
:
rustc 1.65.0-nightly (40336865f 2022-08-15)
binary: rustc
commit-hash: 40336865fe7d4a01139a3336639c6971647e885c
commit-date: 2022-08-15
host: x86_64-pc-windows-msvc
release: 1.65.0-nightly
LLVM version: 15.0.0
Backtrace
thread 'rustc' has overflowed its stack
warning: `whlist` (bin "whlist") generated 9 warnings
error: could not compile `whlist`; 9 warnings emitted
Caused by:
process didn't exit successfully: `rustc --crate-name whlist --edition=2021 src\main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=0d4447f233920318 --out-dir C:\Users\raida\CLionProjects\whlist\target\debug\deps -C incremental=C:\Users\raida\CLionProjects\whlist\target\debug\incremental -L dependency=C:\Users\raida\CLionProjects\whlist\target\debug\deps` (exit code: 0xc00000fd, STATUS_STACK_OVERFLOW)