Skip to main content

nova_rt_str_chars

Function nova_rt_str_chars 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn nova_rt_str_chars( s: *const NovaStr, ) -> *mut u8
Expand description

Decompose s into a Nova [Char].

The result must match exactly what codegen emits for an array: one block holding { len: i64, elem0, elem1, … }, element i at byte offset 8 + 8*i, allocated scanned the way nova_rt_alloc allocates (it takes no scan parameter and always scans). A Char element is its i64 Unicode scalar value, because Ty::Char and Ty::Int are both MirTy::I64.

Scanning an array of scalars can retain garbage that happens to look like a pointer. That is the conservative collector’s existing behaviour for any [Int], not something new here.

§Safety

s must point to a valid NovaStr.