Closed kamadorueda closed 3 months ago
Interesting! Well this is going to be inevitable if your type actually has 128+ dependencies (somehow), but in your case, the function dependency_types
is trying to build ((), ((), ((), ...)))
with a whole lot of empty TypeList
s inside of each other, I'll make a PR to fix that
:laughing: I thought we might be reach that limit at some point!
@escritorio-gustavo One way we could tackle this is by generating a custom TypeList, instead of returning e.g ((((((((((), Type1), Type2), ......)))))
fn dependency_types() -> impl TypeList {
struct List;
impl TypeList for List {
fn for_each(self, v: &mut Visitor) {
v.visit::<Type1>();
v.visit::<Type2>();
OtherType::depencency_types().for_each(v);
...
}
}
List
}
😆 I thought we might be reach that limit at some point!
@escritorio-gustavo One way we could tackle this is by generating a custom TypeList, instead of returning e.g
((((((((((), Type1), Type2), ......)))))
fn dependency_types() -> impl TypeList { struct List; impl TypeList for List { fn for_each(self, v: &mut Visitor) { v.visit::<Type1>(); v.visit::<Type2>(); OtherType::depencency_types().for_each(v); ... } } List }
Cool! That could be the way to fix the case for > 128
dependencies. The thing is... I barely understand the TypeList
currently, so I have no clue how to do that 😅
I'm getting this issue on the 8.0.0
release:
overflow evaluating the requirement
impl ts_rs::typelist::TypeList well-formed
@dessalines The newly released 9.0.0 should fix this!
Nice, thx!
Describe the bug
Since the upgrade from 7.1.1 to 8.1.0, I'm getting recursion limit errors
or
(on a crate that depends on a crate with
#![recursion_limit = "..."]
)To Reproduce
Derive TS on an enum with 130+ fields, for example:
if you comment out some variants, it compiles. There is a point where it stops compiling (the default recursion limit is 128)
Expected behavior
Screenshots
Version 8.1.0