Skip to main content

## validate_crate_name

# Function validate_crate_name

Source

    pub fn validate_crate_name(
        sess: &Session,
        crate_name: Symbol,
        span: Option<Span>,
    )

Expand description

Validate the given crate name.

Note that this validation is more permissive than identifier parsing. It considers non-empty sequences of alphanumeric and underscore characters to be valid crate names. Most notably, it accepts names starting with a numeric character like `0`!

Furthermore, this shouldn’t be taken as the canonical crate name validator. Other places may use a more restrictive grammar (e.g., identifier or ASCII identifier).