In one line: Rust's proposed variadic generics would let you implement a trait for tuples of any length with a single impl. On October 27, Inside Rust published the results of a micro survey with over 3,300 responses, and the arguments that will shape the coming RFC are now out in the open.

Why this, why now

So this week the tug-of-war between "we needed this yesterday" and "don't make the language heavier" became visible, with data.

The problem

Rust has no general way to talk about "a tuple of any length" at the type level. To implement Hash or Clone for tuples you need one impl per arity, (A,), (A, B), (A, B, C), and so on, and in practice people generate a "tuple pyramid" with declarative macros. The standard library's Hash for tuples is done this way.

Real examples:

The pain of the macro workaround (combining the survey, weiznich, and Alice Cecile):

  1. Terrible error messages: they come out as "none of these 16 impls matched".
  2. Compile time: every arity is generated up front whether it is used or not. A user who needs 1, 3, and 128 elements still pays for 1 through 128.
  3. Docs and discoverability: rustdoc shows a wall of impls. The internal #[doc(fake_variadic)] attribute collapses them into one, but it needs nightly rustdoc_internals and does not show the maximum size.
  4. The ceiling: "I implemented up to 12, then a user needed 13" happens again and again.
  5. Lost opportunity: the most striking survey answers are from people who gave up up front, falling back to Vec<Box<dyn Trait>> when they really wanted a tuple of different types, or never writing a tuple impl because the macro was too much hassle.

How it would work