From: Matt Corallo Date: Mon, 26 Apr 2021 16:59:43 +0000 (+0000) Subject: Ensure array lengthgs are Int literals X-Git-Tag: v0.0.98~11^2 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=6bdfcac02eb9cc3b2e511e4dc27a2690b897b58a;p=ldk-c-bindings Ensure array lengthgs are Int literals This fixes a bug where an array will be converted to [u8; StringLiteral] which results in us deciding we don't know how to map it. Fixes: dec732cefbdd97585b7de7fd4a9521f44f1580dd --- diff --git a/c-bindings-gen/src/types.rs b/c-bindings-gen/src/types.rs index c230770..b0a410e 100644 --- a/c-bindings-gen/src/types.rs +++ b/c-bindings-gen/src/types.rs @@ -1458,7 +1458,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { split.next().unwrap(); let tail_str = split.next().unwrap(); assert!(split.next().is_none()); - let len = &tail_str[..tail_str.len() - 1]; + let len = usize::from_str_radix(&tail_str[..tail_str.len() - 1], 10).unwrap(); Some(parse_quote!([u8; #len])) } else { None } } else { None }