Skip to main content

TYPE_CONSTRUCTOR_NAMES

Constant TYPE_CONSTRUCTOR_NAMES 

Source
pub const TYPE_CONSTRUCTOR_NAMES: &[&str];
Expand description

The compiler-owned type constructors, the only names that take an explicit type-argument list in expression position (§3.3’s Counter[(Int, Int)]()).

The parser has to know these by name, because nothing else can tell Counter[(Int, Int)]() from m[key]: the brackets are the same and the contents are ambiguous too — Int is a legal expression, and (Int, Int) a legal tuple of two. parse’s own special case (§7.1) is the precedent for a name-driven decision here.

The list is the §6.1 collection set plus Option, and praxis-hir’s is_type_ctor_name is the other copy of it — the_parsers_type_constructors_are_the_compilers asserts the two agree, so a name in only one cannot go unnoticed.