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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
use crate::compiling::{ImportEntryStep, InsertMetaError};
use crate::{
Id, IrError, IrErrorKind, ParseError, ParseErrorKind, ResolveError, ResolveErrorKind, Spanned,
};
use runestick::{CompileMeta, Item, Location, Visibility};
use thiserror::Error;
error! {
#[derive(Debug)]
pub struct QueryError {
kind: QueryErrorKind,
}
impl From<IrError>;
impl From<ParseError>;
impl From<ResolveError>;
}
#[allow(missing_docs)]
#[derive(Debug, Error)]
pub enum QueryErrorKind {
#[error("{message}")]
Custom { message: &'static str },
#[error("failed to insert meta: {error}")]
InsertMetaError {
#[source]
#[from]
error: InsertMetaError,
},
#[error("{error}")]
IrError {
#[source]
#[from]
error: IrErrorKind,
},
#[error("{error}")]
ParseError {
#[source]
#[from]
error: ParseErrorKind,
},
#[error("{error}")]
ResolveError {
#[source]
#[from]
error: ResolveErrorKind,
},
#[error("missing {what} for id {id:?}")]
MissingId { what: &'static str, id: Option<Id> },
#[error("cannot define conflicting item `{item}`")]
ItemConflict { item: Item, other: Location },
#[error("`{item}` can refer to multiple things")]
AmbiguousItem {
item: Item,
locations: Vec<(Location, Item)>,
},
#[error("`{item}` with {visibility} visibility, is not accessible from module `{from}`")]
NotVisible {
chain: Vec<Location>,
location: Location,
visibility: Visibility,
item: Item,
from: Item,
},
#[error(
"module `{item}` with {visibility} visibility, is not accessible from module `{from}`"
)]
NotVisibleMod {
chain: Vec<Location>,
location: Location,
visibility: Visibility,
item: Item,
from: Item,
},
#[error("missing item for id {id:?}")]
MissingRevId { id: Id },
#[error("missing query meta for module {item}")]
MissingMod { item: Item },
#[error("cycle in import")]
ImportCycle { path: Vec<ImportEntryStep> },
#[error("missing last use component")]
LastUseComponent,
#[error("found indexed entry for `{item}`, but was not an import")]
NotIndexedImport { item: Item },
#[error("{meta} can't be used as an import")]
UnsupportedImportMeta { meta: CompileMeta },
#[error("trying to insert `{current}` but conflicting meta `{existing}` already exists")]
MetaConflict {
current: CompileMeta,
existing: CompileMeta,
},
}