usize, i16, u128 or str is NK1135 outside extern "C" (ADR-286 D36); f32 joins the language in #552Open and answer this issue on GitHub.
language, compiler, ready · opened 2026-10-05 · updated 2026-10-08 · 1 comment
While checking #467’s remaining limit (a use that asks for another width — i16, usize — still reads the const), the following program reached rustc:
fn small() -> i64 {
return 7
}
fn take_usize(x: usize) -> usize {
return x
}
fn take_i16(x: i16) -> i16 {
return x
}
comptime S = small()
fn main() {
println(f"{take_usize(S)} {take_i16(S)}")
}
nikaia run reports rustc’s Mismatched types … You can convert an i64 to an i16. The checker said nothing. The same happens without any comptime: fn take(x: i16) with let y: i16 = 3 passes the checker for usize, i16, i8 and f32. A made-up name (Foo) gets NK1135.
i64, i32, u8, u64 and u32. The specification does not offer others (usize, i8).”n as u128 and n as usize are refused with NK1122. Its note says “The number types are i32, i64, u8, u32, u64 and f64.”extern "C" declaration, usize is C’s size_t and marks a length beside a view (NK1159). That use is specified and tested (tests/foreign_pointers.rs).types.nika’s BUILT_IN lists every Rust primitive (i8 … u128, isize, usize, f32), so NK1135 never fires for them. tests/undeclared_type.rs::every_kind_of_declared_name_is_left_alone asserts on purpose that fn f(a: u8, b: usize, c: i128) is accepted. Its comment calls this “Part I 2.2’s own set”, which the text of 2.2 no longer matches.So the specification does not offer these types but does not say that writing one is refused. Only as is refused, and the test expects the opposite. Today the program goes on to rustc and fails there on a file nobody wrote.
Outside an extern "C" declaration, is a written usize, isize, i8, i16, u16, i128, u128 or f32 refused by the checker?
ref mut, which is refused outside extern "C" with NK1158. Which code?
NK1135: There’s no type called usize., with a note naming the five integer types and f64, and help: Use i64: lengths and indexes are i64, and the compiler converts them for the machine (f64 for f32).NK1122’s sentence, extended from as to any written type.integer_named knows only the five).(a) matches what 2.2 says now. Under (a), undeclared_type.rs’s case flips, and the extern tests stay as they are.
NK1135, except f32, which joins the languageHow it was answered. #509 was decided first, as ADR-286 D36: what is written down is what can be called, and a name Rust has and Nikaia does not is refused. D36 speaks of members (methods, functions, fields), so it did not cover a written type’s name. The owner confirmed that the same principle holds there. f32 is the exception: in the owner’s words it is “clearly an issue”, a type the language should have. It is not a Rust-only name to refuse.
Checked (develop, 0.0.700). fn take(x: T) -> T passes the checker for usize, i16, i8, f32 and u128, while Foo is NK1135. The cause is types.nika’s BUILT_IN, which lists every Rust primitive and also str.
Where it is written (0.0.701)
usize, isize, i8, i16, u16, i128, u128 or str is NK1135. The exception is an extern "C" declaration, where usize is C’s size_t (Part III 15.1, NK1159).NK1135 names the case. The help is i64 for an integer, String for text.f32: ADR-285 D33 and Part I 2.2. It is built in #552.BUILT_IN in crates/nikaia-std/src/tools/types.nika keeps only the language’s types. usize, isize, i8, i16, u16, i128, u128 and str leave it. f32 stays, for #552.NK1135 for those names, with the help i64 (integers) or String (str), and a note naming the language’s number types. Inside an extern "C" declaration nothing changes.
fn take(x: usize), let y: i16 = 3 and fn f(s: str) are each NK1135 with the help.tests/foreign_pointers.rs stays green.tests/undeclared_type.rs::every_kind_of_declared_name_is_left_alone flips for usize and i128; u8 stays accepted.Generated by Claude Code