leo_errors/errors/compiler/
compiler_errors.rs1use crate::create_messages;
18
19use std::{
20 error::Error as ErrorArg,
21 fmt::{Debug, Display},
22};
23
24create_messages!(
25 CompilerError,
27 code_mask: 6000i32,
28 code_prefix: "CMP",
29
30 @backtraced
32 file_read_error {
33 args: (path: impl Debug, error: impl ErrorArg),
34 msg: format!("Cannot read from the provided file path '{path:?}': {error}"),
35 help: None,
36 }
37
38 @formatted
40 illegal_static_member_assignment {
41 args: (member: impl Display),
42 msg: format!("Tried to assign to static member `{member}`"),
43 help: None,
44 }
45
46 @formatted
47 import_not_found {
48 args: (file_path: impl Display),
49 msg: format!("Attempted to import a file that does not exist `{file_path}`."),
50 help: None,
51 }
52
53 @formatted
54 cannot_open_cwd {
55 args: (err: impl ErrorArg),
56 msg: format!("Failed to open current working directory. Error: {err}"),
57 help: None,
58 }
59
60 @formatted
61 program_name_should_match_file_name {
62 args: (program_name: impl Display, file_name: impl Display),
63 msg: format!("The program name `{program_name}` must match {file_name}"),
64 help: None,
65 }
66
67 @formatted
69 program_scope_name_does_not_match {
70 args: (program_scope_name: impl Display, file_name: impl Display),
71 msg: format!("The program scope name `{program_scope_name}` must match `{file_name}`."),
72 help: None,
73 }
74
75 @formatted
76 imported_program_not_found {
77 args: (main_program_name: impl Display, dependency_name: impl Display),
78 msg: format!("`{main_program_name}` imports `{dependency_name}.aleo`, but `{dependency_name}.aleo` is not found in program manifest. Use `leo add --help` for more information on how to add a dependency."),
79 help: None,
80 }
81
82 @formatted
83 const_not_evaluated {
84 args: (),
85 msg: "The value of this const could not be determined at compile time.".to_string(),
86 help: None,
87 }
88
89 @formatted
90 loop_bounds_not_evaluated {
91 args: (),
92 msg: "This loop bound could not be determined at compile time.".to_string(),
93 help: None,
94 }
95
96 @formatted
97 array_index_not_evaluated {
98 args: (),
99 msg: "This array index could not be determined at compile time.".to_string(),
100 help: None,
101 }
102
103 @formatted
104 const_prop_unroll_many_loops {
105 args: (bound: usize),
106 msg: format!("The const propagation and loop unrolling passes ran {bound} times without reaching a fixed point."),
107 help: Some("This should only happen with a pathological Leo program containing numerous nested loops or nested operations. Otherwise, this may be a bug in the Leo compiler.".to_string()),
108 }
109
110 @backtraced
111 failed_ast_file {
112 args: (filename: impl Display, error: impl Display),
113 msg: format!("Failed to write AST to file {filename}: {error}."),
114 help: None,
115 }
116
117 @formatted
118 const_generic_not_resolved {
119 args: (kind: impl Display, item: impl Display),
120 msg: format!("Unable to resolve {kind} `{item}`. A non-const expression was provided where a const generic parameter is required."),
121 help: None,
122 }
123
124 @formatted
125 array_length_not_evaluated {
126 args: (),
127 msg: "This array length could not be determined at compile time.".to_string(),
128 help: None,
129 }
130
131 @formatted
132 repeat_count_not_evaluated {
133 args: (),
134 msg: "This repeat count could not be determined at compile time.".to_string(),
135 help: None,
136 }
137);