aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/body/diagnostics.rs
blob: 1de7d30e200e87c12edf2046ed2e7ccdaef25023 (plain)
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
//! Diagnostics emitted during body lowering.

use hir_expand::diagnostics::DiagnosticSink;

use crate::diagnostics::{InactiveCode, MacroError, UnresolvedProcMacro};

#[derive(Debug, Eq, PartialEq)]
pub(crate) enum BodyDiagnostic {
    InactiveCode(InactiveCode),
    MacroError(MacroError),
    UnresolvedProcMacro(UnresolvedProcMacro),
}

impl BodyDiagnostic {
    pub(crate) fn add_to(&self, sink: &mut DiagnosticSink<'_>) {
        match self {
            BodyDiagnostic::InactiveCode(diag) => {
                sink.push(diag.clone());
            }
            BodyDiagnostic::MacroError(diag) => {
                sink.push(diag.clone());
            }
            BodyDiagnostic::UnresolvedProcMacro(diag) => {
                sink.push(diag.clone());
            }
        }
    }
}