leo_errors/errors/static_analyzer/
static_analyzer_error.rs1use crate::create_messages;
18use std::fmt::{Debug, Display};
19
20create_messages!(
23 StaticAnalyzerError,
25 code_mask: 4000i32,
26 code_prefix: "SAZ",
27
28 @formatted
29 no_path_awaits_all_futures_exactly_once {
30 args: (num_total_paths: impl Display),
31 msg: format!("Futures must be awaited exactly once. Out of `{num_total_paths}`, there does not exist a single path in which all futures are awaited exactly once."),
32 help: Some("Ex: for `f: Future` call `f.await()` to await a future. Remove duplicate future await redundancies, and add future awaits for un-awaited futures.".to_string()),
33 }
34
35 @formatted
36 future_awaits_missing {
37 args: (unawaited: impl Display),
38 msg: format!("The following futures were never awaited: {unawaited}"),
39 help: Some("Ex: for `f: Future` call `f.await()` to await a future.".to_string()),
40 }
41
42 @formatted
43 invalid_await_call {
44 args: (),
45 msg: "Not a valid await call.".to_string(),
46 help: Some("Ex: for `f: Future` call `f.await()` or `Future::await(f)` to await a future.".to_string()),
47 }
48
49 @formatted
50 expected_future {
51 args: (type_: impl Display),
52 msg: format!("Expected a future, but found `{type_}`"),
53 help: Some("Only futures can be awaited.".to_string()),
54 }
55
56 @formatted
57 async_transition_call_with_future_argument {
58 args: (function_name: impl Display),
59 msg: format!("The call to {function_name} will result in failed executions on-chain."),
60 help: Some("There is a subtle error that occurs if an async transition call follows a non-async transition call, and the async call returns a `Future` that itself takes a `Future` as an input. See See `https://github.com/AleoNet/snarkVM/issues/2570` for more context.".to_string()),
61 }
62
63 @formatted
64 misplaced_future {
65 args: (),
66 msg: "A future may not be used in this way".to_string(),
67 help: Some("Futures should be created, assigned to a variable, and consumed without being moved or reassigned.".to_string()),
68 }
69
70 @formatted
71 compile_time_unary_op {
72 args: (value: impl Display, op: impl Display, err: impl Display),
73 msg: format!("Unary operation `{value}.{op}()` failed at compile time: {err}."),
74 help: None,
75 }
76
77 @formatted
78 compile_time_binary_op {
79 args: (value_lhs: impl Display, value_rhs: impl Display, op: impl Display, err: impl Display),
80 msg: format!("Binary operation `{value_lhs} {op} {value_rhs}` failed at compile time: {err}."),
81 help: None,
82 }
83
84 @formatted
85 compile_time_cast {
86 args: (value: impl Display, type_: impl Display),
87 msg: format!("Compile time cast failure: `{value} as {type_}`."),
88 help: None,
89 }
90
91 @formatted
92 compile_core_function {
93 args: (err: impl Display),
94 msg: format!("Error during compile time evaluation of this core function: {err}."),
95 help: None,
96 }
97
98 @formatted
99 array_bounds {
100 args: (index: impl Display, len: impl Display),
101 msg: format!("Array index {index} out of bounds (array length is {len})."),
102 help: None,
103 }
104);