summaryrefslogtreecommitdiff
path: root/src/codegen/mod.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2018-07-06 05:01:48 -0400
committerGitHub <noreply@github.com>2018-07-06 05:01:48 -0400
commit6a480ffeb8d30a2ea58dc7e605a0274ca29e28cb (patch)
tree767f3830c0a63fe0844ea293c7fcddb37c70d477 /src/codegen/mod.rs
parentc197acf847c4ea6012061c1246668514059c34ae (diff)
parentb3e41a2924bb60e0a308bd2d35c8b9c0126a7249 (diff)
Auto merge of #1346 - emilio:wchar, r=fitzgen
ir: Don't assume wchar is 2 bytes. Fixes #1345
Diffstat (limited to 'src/codegen/mod.rs')
-rw-r--r--src/codegen/mod.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs
index 026e9475..2a0891d9 100644
--- a/src/codegen/mod.rs
+++ b/src/codegen/mod.rs
@@ -2978,6 +2978,12 @@ impl TryToRustTy for Type {
IntKind::ULong => Ok(raw_type(ctx, "c_ulong")),
IntKind::LongLong => Ok(raw_type(ctx, "c_longlong")),
IntKind::ULongLong => Ok(raw_type(ctx, "c_ulonglong")),
+ IntKind::WChar { size } => {
+ let ty = Layout::known_type_for_size(size)
+ .expect("Non-representable wchar_t?");
+ let ident = ctx.rust_ident_raw(ty);
+ Ok(quote! { #ident })
+ },
IntKind::I8 => Ok(quote! { i8 }),
IntKind::U8 => Ok(quote! { u8 }),