Items

Items

This chapter describes items in Rue.

Items are top-level definitions in a program. Unlike statements, items are visible throughout the module.

Type Name Uniqueness

User-defined type names (structs and enums) MUST be unique within a program. Defining multiple types with the same name produces a compile-time error.

User-defined types MUST NOT use names reserved for built-in types. Currently, the only reserved type name is String.

// Error: cannot define type with reserved name
struct String { data: i32 }  // compile error

In this section