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