2019-11-03 21:11:37 +00:00
|
|
|
//! Diagnostics produced by `hir_def`.
|
|
|
|
|
2019-10-31 15:45:10 +00:00
|
|
|
use std::any::Any;
|
|
|
|
|
|
|
|
use hir_expand::diagnostics::Diagnostic;
|
2019-11-03 22:14:17 +00:00
|
|
|
use ra_db::RelativePathBuf;
|
2019-10-31 15:45:10 +00:00
|
|
|
use ra_syntax::{ast, AstPtr, SyntaxNodePtr};
|
|
|
|
|
2019-11-28 09:50:26 +00:00
|
|
|
use hir_expand::{HirFileId, InFile};
|
2019-10-31 15:45:10 +00:00
|
|
|
|
|
|
|
#[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()
|
|
|
|
}
|
2019-11-28 09:50:26 +00:00
|
|
|
fn source(&self) -> InFile<SyntaxNodePtr> {
|
|
|
|
InFile { file_id: self.file, value: self.decl.into() }
|
2019-10-31 15:45:10 +00:00
|
|
|
}
|
|
|
|
fn as_any(&self) -> &(dyn Any + Send + 'static) {
|
|
|
|
self
|
|
|
|
}
|
|
|
|
}
|