Skip to main content

RESERVED_TYPE_NAMES

Constant RESERVED_TYPE_NAMES 

Source
pub const RESERVED_TYPE_NAMES: [&str; 7];
Expand description

Type names the compiler owns, which a user type declaration may not take.

nova-typeck’s convert_ty resolves each of these to its built-in type, or to a shadowing generic parameter, wherever it runs — never to a declaration under this name, which is what resolve_type would have to find instead. So a type declared under one of these names could never be referred to in a type annotation.

That is narrower than “every use”. A record literal resolves its head through resolve_type directly, never through convert_ty (check_record_literal), and a sum type’s variants live in the value namespace, independent of the type name — so construction and pattern matching for a type declared under one of these names worked before this list was enforced. An impl header’s self type is a convert_ty site too, so an impl written for one of these names attaches to the built-in, never to the declaration. So what worked before this list was enforced was construction, pattern matching, and inferred local bindings; a signature or an impl did not. See CHANGELOG.md for exactly what this change breaks.

Future is here and is not a primitive: it is the one built-in type name taking a type argument, handled separately from the nullary table. Unit is deliberately absent — it is not a nameable type name; unit is spelled ().

Bytes joined later, for the same reason as the five original primitives: an ordinary nullary entry in convert_ty’s table, with no carve-out of its own like Future’s or Unit’s above.

This is the list, and both convert_ty’s and qualifier_self_ty’s built-in-name tables (crates/nova-typeck/src/check.rs) are expected to agree with it.