Skip to main content

inkwell/
error.rs

1/// Errors for operations involving alignment.
2#[derive(Debug, thiserror::Error, PartialEq, Eq)]
3pub enum AlignmentError {
4    #[error("{0} is not a power of two and cannot be used for alignment")]
5    NonPowerOfTwo(u32),
6    #[error("The src_align_bytes argument was not a power of two.")]
7    SrcNonPowerOfTwo(u32),
8    #[error("The dest_align_bytes argument was not a power of two.")]
9    DestNonPowerOfTwo(u32),
10    #[error(
11        "Type is unsized and cannot be aligned. \
12    Suggestion: Align memory manually."
13    )]
14    Unsized,
15    #[error("Value is not an alloca, load, or store instruction.")]
16    UnalignedInstruction,
17}
18
19/// The top-level Error type for the inkwell crate.
20#[derive(Debug, thiserror::Error, PartialEq, Eq)]
21pub enum Error {
22    #[error("Builder Error: {0}")]
23    BuilderError(#[from] crate::builder::BuilderError),
24    #[error("InstructionValue Error: {0}")]
25    InstructionValueError(#[from] crate::values::InstructionValueError),
26    #[error("Basic types must have names.")]
27    EmptyNameError,
28    #[error("Metadata is expected to be a node.")]
29    GlobalMetadataError,
30}