What reference says about the attribute:
The
type_length_limit
attribute limits the maximum number of type substitutions made when constructing a concrete type during monomorphization. It is applied at the crate level, and uses the MetaNameValueStr syntax to set the limit based on the number of type substitutions.
#![type_length_limit = "4"]
fn f<T>(x: T) {}
// This fails to compile because monomorphizing to
// `f::<((((i32,), i32), i32), i32)>` requires more than 4 type elements.
f(((((1,), 2), 3), 4));
My question:
Is this code example correct? In my mind, there's only one instance of the function after monomorphization (f::<((((i32,), i32), i32), i32)>) and it fails to compile because the limit is too low to even compile empty main function.