summaryrefslogtreecommitdiff
path: root/library/src/compute
diff options
context:
space:
mode:
authorNaim A <227396+naim94a@users.noreply.github.com>2023-03-30 00:07:08 +0300
committerGitHub <noreply@github.com>2023-03-29 23:07:08 +0200
commit2ed4212c760701e308dcf6c740720d18e8f2dbf1 (patch)
tree652bdb71c5b27becb50f76bc5d9097ef966c2079 /library/src/compute
parentf04b6ebc1a17e22596c16158042030f910b85559 (diff)
bail! when #symbol is called without parameters (#440)
Diffstat (limited to 'library/src/compute')
-rw-r--r--library/src/compute/construct.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/library/src/compute/construct.rs b/library/src/compute/construct.rs
index a30faf2e..04195f42 100644
--- a/library/src/compute/construct.rs
+++ b/library/src/compute/construct.rs
@@ -258,6 +258,9 @@ pub fn symbol(
variants: Vec<Spanned<Variant>>,
) -> Value {
let mut list = Vec::new();
+ if variants.is_empty() {
+ bail!(args.span, "expected at least one variant");
+ }
for Spanned { v, span } in variants {
if list.iter().any(|(prev, _)| &v.0 == prev) {
bail!(span, "duplicate variant");