1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! Error-related definitions generated by `error_chain`
use types::TypeName;
use module::FunctionRef;
error_chain! {
errors {
/// The compiler was provided with a cyclic graph, but the data flow graph
/// should always be acyclic
CyclicGraph {
description("graph is cyclic")
display("graph is cyclic")
}
/// A call node is referencing an unknown function
MissingFunction(index: FunctionRef) {
description("missing function")
display("missing function {:?}", index)
}
/// A node is not receiving the expected number of values
WrongArgumentsCount(actual: usize, expected: usize) {
description("wrong number of arguments")
display("got {} arguments, expected {}", actual, expected)
}
/// A composite type was acessed with an invalid index (eg. 2 in a `vec2`)
IndexOutOfBound(index: u32, len: u32) {
description("index out of bounds")
display("index out of bounds ({} >= {})", index, len)
}
/// A generic arguments error, usually thrown when a node receives a combination of
/// types it cannot handle
BadArguments(args: Box<[&'static TypeName]>) {
description("bad arguments")
display("bad arguments: {:?}", args)
}
/// Hopefully temporary error type, thrown when creating a constant with a type not yet supported
UnsupportedConstant(ty: &'static TypeName) {
description("unsupported constant type")
display("unsupported constant type {:?}", ty)
}
/// A node is used in an incompatible context
UnsupportedOperation(name: &'static str) {
description("unsupported operation")
display("unsupported operation {}", name)
}
/// Used to wrap another error with metadata about its origin node
BuildError(node: &'static str, id: usize) {
description("build error")
display("compilation failed at {} node with id {}", node, id)
}
}
}