Skip to content

c_char is a type of its own on every target (D207, #3375) - #3430

Merged
ehartford merged 1 commit into
mainfrom
c-char-type
Nov 18, 2026
Merged

ehartford merged 1 commit into
mainfrom
c-char-type

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Closes #3375. Implements §16.1 as blessed 2026-11-18 (spec v7.59, D207).

The type. c_char is one byte with the target's char signedness and is never i8 or u8; a pointer, slice or collection of it is never one of theirs. The #3375 defect (a resource over *mut c_char receiving every unsigned char * parameter on linux-aarch64 and none elsewhere) cannot occur: the types differ everywhere.

Without as: a c_char widens into i16, i32, i64, isize; a literal 0 to 127 and an ASCII character literal are c_chars; two c_chars compute and compare.

Refused, with the spelling, the same on every target: a value conversion to or from u8 / i8; a narrowing into c_char; widening into an unsigned type; a literal outside 0 to 127; arithmetic, ordering or equality beside a u8, an i8 or a wider unsigned integer; a pointer or collection used as one of i8 / u8.

Tree changes the rules required: 44 pointer conversions in rt/wasm.w (the one runtime file only an unsigned-char target compiles) and one comparison in a test's embedded driver (behav_migrate_va_list). No example, UAT scenario or corpus changed. Clone, Debug, Display for c_char.

ABI v14. No layout or passing rule changes; the version moves so every stored bundle is rebuilt once and its interface spells c_char.

Tests: behav_3375_c_char_own_type and 14 err_3375_c_char_*; all 13 refusals probed are identical on darwin and --target aarch64-linux-gnu.

Battery green on the branch tip; :release-checks green.

…ith the target's char signedness, never an alias of i8 or u8. A pointer, slice or collection of c_char is never one of i8 or u8. Without as, a c_char widens into a wider signed type and nothing else; a value conversion to or from u8 or i8, a narrowing into c_char, and arithmetic, ordering or equality beside a u8, an i8 or a wider unsigned integer are refused with the spelling; an integer literal is a c_char from 0 to 127. The same program is accepted or refused on every target. rt/wasm.w converts its 44 byte pointers at the c_char seams. ABI v14: stored bundles are rebuilt once, their interfaces spelling c_char (#3375)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant