Repository: immunant/c2rust (language: rust)

Issue:
transpile: Init list not implemented for Uint
```C
int f() {
    unsigned x = { 1 };
    return x;
}

int g() {
    int x = { 1 };
    return x;
}
```

Translation of `g` succeeds.  Translation of `f` fails, complaining "Init list not implemented for Uint", and `f` is omitted from the generated Rust code.


Discussion / hints:
I think the fix to support any scalar type should be pretty trivial.

Fix patch:
diff --git a/c2rust-transpile/src/translator/literals.rs b/c2rust-transpile/src/translator/literals.rs
index d35fce2d4a..d8eb64db64 100644
--- a/c2rust-transpile/src/translator/literals.rs
+++ b/c2rust-transpile/src/translator/literals.rs
@@ -249,7 +249,7 @@ impl<'c> Translation<'c> {
             CTypeKind::Vector(CQualTypeId { ctype, .. }, len) => {
                 self.vector_list_initializer(ctx, ids, ctype, len)
             }
-            CTypeKind::Char | CTypeKind::Int => {
+            ref kind if kind.is_integral_type() => {
                 let id = ids.first().unwrap();
                 self.convert_expr(ctx.used(), *id)
             }


Test patch: