Skip to content

Commit

Permalink
chore: make nested slice error more clear in case
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljklein committed Sep 3, 2024
1 parent 6f30e42 commit 1f77947
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion compiler/noirc_evaluator/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub enum RuntimeError {
StaticAssertDynamicPredicate { call_stack: CallStack },
#[error("Argument is false")]
StaticAssertFailed { call_stack: CallStack },
#[error("Nested slices are not supported")]
#[error("Nested slices, i.e. slices within an array or slice, are not supported")]
NestedSlice { call_stack: CallStack },
#[error("Big Integer modulus do no match")]
BigIntModulus { call_stack: CallStack },
Expand Down
6 changes: 3 additions & 3 deletions compiler/noirc_frontend/src/hir/resolution/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pub enum ResolverError {
NumericConstantInFormatString { name: String, span: Span },
#[error("Closure environment must be a tuple or unit type")]
InvalidClosureEnvironment { typ: Type, span: Span },
#[error("Nested slices are not supported")]
#[error("Nested slices, i.e. slices within an array or slice, are not supported")]
NestedSlices { span: Span },
#[error("#[recursive] attribute is only allowed on entry points to a program")]
MisplacedRecursiveAttribute { ident: Ident },
Expand Down Expand Up @@ -323,8 +323,8 @@ impl<'a> From<&'a ResolverError> for Diagnostic {
format!("{typ} is not a valid closure environment type"),
"Closure environment must be a tuple or unit type".to_string(), *span),
ResolverError::NestedSlices { span } => Diagnostic::simple_error(
"Nested slices are not supported".into(),
"Try to use a constant sized array instead".into(),
"Nested slices, i.e. slices within an array or slice, are not supported".into(),
"Try to use a constant sized array or BoundedVec instead".into(),
*span,
),
ResolverError::MisplacedRecursiveAttribute { ident } => {
Expand Down

0 comments on commit 1f77947

Please sign in to comment.