Skip to content

Commit cbce369

Browse files
alexcrichtonsunfishcode
authored andcommitted
Address some review feedback
1 parent 3cf4e19 commit cbce369

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

phases/ephemeral/docs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Types
2-
## <a href="#size" name="size"></a> `size`: `u32`
2+
## <a href="#size" name="size"></a> `size`: `usize`
33
An array size.
44

55
Note: This is similar to `size_t` in POSIX.

tools/witx/src/ast.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,19 @@ impl Type {
211211

212212
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
213213
pub enum BuiltinType {
214+
/// This is a 32-bit unicode scalar value, not a code point.
215+
///
216+
/// Same as the Rust language's `char` type.
214217
Char,
215218
U8 {
216219
/// Indicates whether this type is intended to represent the `char`
217220
/// type in the C language. The C `char` type is often unsigned, but
218221
/// it's language-specific. At an interface-types level this is an
219222
/// unsigned byte but binding generators may wish to bind this as the
220223
/// language-specific representation for a C character instead.
224+
///
225+
/// This is also currently used exclusively in conjunction with `@witx
226+
/// pointer` to hint that it's pointing to unicode string data as well.
221227
lang_c_char: bool,
222228
},
223229
U16,

tools/witx/src/docs/ast.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,12 @@ impl BuiltinType {
291291
BuiltinType::Char => "char",
292292
BuiltinType::U8 { .. } => "u8",
293293
BuiltinType::U16 => "u16",
294-
BuiltinType::U32 { .. } => "u32",
294+
BuiltinType::U32 {
295+
lang_ptr_size: false,
296+
} => "u32",
297+
BuiltinType::U32 {
298+
lang_ptr_size: true,
299+
} => "usize",
295300
BuiltinType::U64 => "u64",
296301
BuiltinType::S8 => "s8",
297302
BuiltinType::S16 => "s16",

0 commit comments

Comments
 (0)