aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/diagnostics.rs
blob: eda9b2269a45a4b83a51dcba8e13edc25a7645ad (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 produced by `hir_def`.

use std::any::Any;

use hir_expand::diagnostics::Diagnostic;
use ra_db::RelativePathBuf;
use ra_syntax::{ast, AstPtr, SyntaxNodePtr};

use hir_expand::{HirFileId, Source};

#[derive(Debug)]
pub struct UnresolvedModule {
    pub file: HirFileId,
    pub decl: AstPtr<ast::Module>,
    pub candidate: RelativePathBuf,
}

impl Diagnostic for UnresolvedModule {
    fn message(&self) -> String {
        "unresolved module".to_string()
    }
    fn source(&self) -> Source<SyntaxNodePtr> {
        Source { file_id: self.file, value: self.decl.into() }
    }
    fn as_any(&self) -> &(dyn Any + Send + 'static) {
        self
    }
}