thread 'rustc' has overflowed its stack
Closed this issue · 1 comments
NyxCode commented
Code
#[derive(TS)]
struct X<T> {
a: T,
b: Vec<X<(i32, T)>>
}
Expected Output
type X<T> = {
a: T,
b: Array<X<[number, T]>>,
}
But instead..
thread 'rustc' has overflowed its stack
error: could not compile `ts-rs` (test "generics")
Env
using stable-x86_64-pc-windows-msvc
on rustc 1.75.0 (82e1608df 2023-12-21)
also happens using rustc 1.77.0-nightly (bf3c6c5be 2024-02-01)
NyxCode commented
Okay, all this makes sense, and it isn't related to ts-rs.
We generate an impl like this:
impl<T: TS> TS for X<T> { .. }
So to check if X<something>
implements TS
, rustc has to check X<(i32, T)>
, and for that, it has to check X<(i32, (i32, T))>
, and for that.....
I guess I was confused by rustc just crashing. Normally, this results in an only slightly confusing error.