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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
// use std::backtrace::Backtrace;
// use crate::{DiagCtxtHandle, Subdiagnostic};
// use crate::Color;
// use crate::ColorSpec;
// use std::borrow::Cow;
// use std::cell::Cell;
// use std::fmt;
// use std::fmt::Debug;
// use std::marker::PhantomData;
// use std::ops::{Deref, DerefMut};
// use std::path::{Path, PathBuf};
// use std::thread::panicking;
// use crate::daemonic::daemonic_contract::daemonic_result::diagnostic::EmissionGuarantee;
use Cow;
use Box;
use Vec;
use PhantomData;
/// Useful type to use with `Result<>` indicate that an error has already
/// been reported to the user, so no need to continue checking.
///
/// The `()` field is necessary: it is non-`pub`, which means values of this
/// type cannot be constructed outside of this crate.
///
/// #[derive(HashStable_Generic)]
// This technically uses unstable traits in std lib, but presents as stable on the surface.
);
/// This is a marker for a fatal compiler error used with `resume_unwind`.
;
/// Used as a return value to signify a fatal error occurred.
;
;
/// Simplified version of `FluentValue` that can implement `Encodable` and `Decodable`. Converted
/// to a `FluentValue` by the emitter to be used in diagnostic translation.
/// Used for emitting structured error messages and other diagnostic information.
/// Wraps a `DiagInner`, adding some useful things.
/// - The `dcx` field, allowing it to (a) emit itself, and (b) do a drop check
/// that it has been emitted or cancelled.
/// - The `EmissionGuarantee`, which determines the type returned from `emit`.
///
/// Each constructed `Diag` must be consumed by a function such as `emit`,
/// `cancel`, `delay_as_bug`, or `into_diag`. A panic occurs if a `Diag`
/// is dropped without being consumed by one of these functions.
///
/// If there is some state in a downstream crate you would like to access in
/// the methods of `Diag` here, consider extending `DiagCtxtFlags`.
/// The main part of a diagnostic. Note that `Diag`, which wraps this type, is
/// used for most operations, and should be used instead whenever possible.
/// This type should only be used when `Diag`'s lifetime causes difficulties,
/// e.g. when storing diagnostics within `DiagCtxt`.
/// A "sub"-diagnostic attached to a parent diagnostic.
/// For example, a note attached to an error.
/// | Level | is_error | EmissionGuarantee | Top-level | Sub | Used in lints?
/// | ----- | -------- | ----------------- | --------- | --- | --------------
/// | Bug | yes | BugAbort | yes | - | -
/// | Fatal | yes | FatalAbort/FatalError[^star] | yes | - | -
/// | Error | yes | ErrorGuaranteed | yes | - | yes
/// | DelayedBug | yes | ErrorGuaranteed | yes | - | -
/// | ForceWarning | - | () | yes | - | lint-only
/// | Warning | - | () | yes | yes | yes
/// | Note | - | () | rare | yes | -
/// | OnceNote | - | () | - | yes | lint-only
/// | Help | - | () | rare | yes | -
/// | OnceHelp | - | () | - | yes | lint-only
/// | FailureNote | - | () | rare | - | -
/// | Allow | - | () | yes | - | lint-only
/// | Expect | - | () | yes | - | lint-only
///
/// [^star]: `FatalAbort` normally, `FatalError` in the non-aborting "almost fatal" case that is
/// occasionally used.
/// Note for Daemonic Consumers, *DiagnosticLevel is NOT GlassState*
///
/// This is technically a nested trait object from the reference frame of DaemonicError.
/// Most users/devs should never need to directly call this part of the logic solely because its compiler
/// specific in 99% of use cases.
///
/// This is from and originally designed for RustC error and its internal representations for
/// error states, GlassStates encapsulate full state in most cases (or at least should) these do not.
/// Even with a fully constructed Diagnostic message with args and Span arent as rich as
/// A pure Daemonic Error or GlassState derivation of the same state within shared context.
/// A `DiagCtxt` deals with errors and other compiler output.
/// Certain errors (fatal, bug, unimpl) may cause immediate exit,
/// others log errors for later reporting.
// Replacement sketch provided by Ada. Love that girl <3
// todo: this is stubbed