From 6bdfcac02eb9cc3b2e511e4dc27a2690b897b58a Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 26 Apr 2021 16:59:43 +0000 Subject: [PATCH] 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 --- c-bindings-gen/src/types.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 } -- 2.39.5