summaryrefslogtreecommitdiffstats
path: root/crates/rebel-parse/src/grammar/recipe.rs
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2024-04-29 18:50:40 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2024-04-29 18:53:02 +0200
commit8226a8ec820987c99c24b5f6e76a8b379f9efa0a (patch)
tree3793b6aefa5b5e59a2c69ead68d96dc1e8faad89 /crates/rebel-parse/src/grammar/recipe.rs
parent5a09ae2978e5fcd7a4894bd87324c0ca9c11826e (diff)
downloadrebel-8226a8ec820987c99c24b5f6e76a8b379f9efa0a.tar
rebel-8226a8ec820987c99c24b5f6e76a8b379f9efa0a.zip
rebel-parse: limit explicit array length specification to u32
Diffstat (limited to 'crates/rebel-parse/src/grammar/recipe.rs')
-rw-r--r--crates/rebel-parse/src/grammar/recipe.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/rebel-parse/src/grammar/recipe.rs b/crates/rebel-parse/src/grammar/recipe.rs
index 68d43dc..893d4b7 100644
--- a/crates/rebel-parse/src/grammar/recipe.rs
+++ b/crates/rebel-parse/src/grammar/recipe.rs
@@ -68,7 +68,7 @@ peg::parser! {
}
/ p('[') typ:typ() len:tagged(<p(';')>, <number()>)? p(']') { ?
let len = len
- .map(|n| usize::try_from(n).or(Err("Invalid array length")))
+ .map(|n| u32::try_from(n).or(Err("Invalid array length")))
.transpose()?;
Ok(typ::Literal::Array(Box::new(typ), len))
}