I got this error from time to time in projets using futures. I just add the type_length_limit attribute and call it a day but I'm wondering if it should be avoided.
error: reached the type-length limit while instantiating `std::sync::Once::call_once::<[closure@DefId(44/1:587 ~ futures[b...`
|
= note: consider adding a `#![type_length_limit="2097152"]` attribute to your crate
I'm afraid I've also hit this and I'm a bit worried. First, I'm not entirely sure what it means ‒ I mean I can guess it is kind of „you have composed a very complex type“, but what does that number specify?
Sure, the code is full of generic layers and impl Traits and closures wrapping other closures. It's not all at one place, though, I hope each local part in itself is readable.