varar_core/
diagnostics.rs1use crate::span::Span;
5
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Severity {
9 Error,
10 Warning,
11 Info,
12}
13
14#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
17pub enum DiagnosticCode {
18 AmbiguousMatch,
19 ErrorFenceWithoutStep,
20 Drift,
21}
22
23#[derive(Clone, Copy, Debug, PartialEq, Eq)]
25pub struct Diagnostic {
26 pub code: DiagnosticCode,
27 pub severity: Severity,
28 pub span: Span,
29}
30
31pub fn ambiguous_match(span: Span) -> Diagnostic {
33 Diagnostic {
34 code: DiagnosticCode::AmbiguousMatch,
35 severity: Severity::Error,
36 span,
37 }
38}
39
40pub fn error_fence_without_step(span: Span) -> Diagnostic {
42 Diagnostic {
43 code: DiagnosticCode::ErrorFenceWithoutStep,
44 severity: Severity::Error,
45 span,
46 }
47}