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
use llvm_bitstream::error::Error as BitstreamError;
use thiserror::Error as ThisError;
use crate::block::{BlockId, StrtabError};
use crate::map::MapCtxError;
use crate::record::DataLayoutParseError;
#[derive(Debug, ThisError)]
pub enum Error {
#[error("error while parsing the bitstream: {0}")]
Parse(#[from] BitstreamError),
#[error("error while unrolling the bitstream: {0}")]
BadUnroll(String),
#[error("error while mapping record: {0}")]
BadRecordMap(String),
#[error("error while mapping block: {0}")]
BadBlockMap(String),
#[error("error while decoding record field: {0}")]
BadField(String),
#[error("expected exactly one record of code {0} in block {1:?}")]
BlockRecordMismatch(u64, BlockId),
#[error("expected exactly one block of ID {0:?} in block {1:?}")]
BlockBlockMismatch(BlockId, BlockId),
#[error("error while parsing datalayout: {0}")]
BadDataLayout(#[from] DataLayoutParseError),
#[error("invalid mapping context: {0}")]
BadContext(#[from] MapCtxError),
#[error("error while accessing string table: {0}")]
BadStrtab(#[from] StrtabError),
#[error("unsupported: {0}")]
Unsupported(String),
}