Generic, What is the relationship between T and [T]

IMO it’s best to think of the compiler accepting type Illegal = [[i32]]; as a delayed type error[1], and the compiler accepting <[[i32]] as Trait>::AssociatedType as a bug.

So @Rgoogle: For all practical purposes, especially from a language learner’s perspective, it should be very clear that “[[i32]]” is not a real type, and doesn’t have any real meaning beyond being “something that will produce a compilation error”.

I generally do like the “well, technically…” remarks myself, but in this topic, it would probably only cause confusion to discuss the meaning of “[[i32]]” any further than “doesn’t exist”/“compilation error”.


  1. not entirely unlike macro_rules! illegal { () => { [[i32]] } } which works, too, of course, until you really use illegal!() as a type somewhere ↩︎

1 Like