Skip to content

Commit 72a262a

Browse files
authored
Change repr of char8 from char to u8 (#43)
This follows directly from the discussion in #42 where we agreed that `char8` is essentially a named "alias" to a byte type (`u8`) and represents a code *unit* (much like `char8_t` in C++20), rather than a code *point* (as is the case with multi-byte type `char` in Rust).
1 parent 0a3c7bc commit 72a262a

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

crates/generate-raw/src/lib.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -241,13 +241,11 @@ impl Render for BuiltinType {
241241
BuiltinType::S64 => src.push_str("i64"),
242242
BuiltinType::F32 => src.push_str("f32"),
243243
BuiltinType::F64 => src.push_str("f64"),
244-
BuiltinType::USize => {
245-
// TODO verify handling of USize
246-
src.push_str("usize")
247-
}
244+
BuiltinType::USize => src.push_str("usize"),
248245
BuiltinType::Char8 => {
249-
// TODO verify handling of Char8
250-
src.push_str("char")
246+
// Char8 represents a UTF8 code *unit* (`u8` in Rust, `char8_t` in C++20)
247+
// rather than a code *point* (`char` in Rust which is multi-byte)
248+
src.push_str("u8")
251249
}
252250
}
253251
}

0 commit comments

Comments
 (0)