charon_lib/ast/builtins.rs
1//! This file contains information about the builtin functions/types/traits definitions
2//!
3//! **IMPORTANT**:
4//! When checking whether names are equal to one of the reference names below,
5//! we ignore the disambiguators (see [crate::names] and [crate::ast::names_utils]).
6// TODO: rename to "primitive"
7
8use crate::names::*;
9use crate::types::*;
10
11// Built-in functions
12// We treat this one specially in the `inline_local_panic_functions` pass. See there for details.
13pub static EXPLICIT_PANIC_NAME: &[&str] = &["core", "panicking", "panic_explicit"];
14
15impl BuiltinTy {
16 pub fn get_name(self) -> Name {
17 let name: &[_] = match self {
18 BuiltinTy::Box => &["alloc", "boxed", "Box"],
19 BuiltinTy::Str => &["Str"],
20 BuiltinTy::Array => &["Array"],
21 BuiltinTy::Slice => &["Slice"],
22 };
23 Name::from_path(name)
24 }
25}