2019-11-04 00:11:37 +03:00
|
|
|
//! Diagnostics produced by `hir_def`.
|
|
|
|
|
2019-10-31 18:45:10 +03:00
|
|
|
use std::any::Any;
|
|
|
|
|
|
|
|
use hir_expand::diagnostics::Diagnostic;
|
2020-04-17 13:55:05 +02:00
|
|
|
use ra_syntax::{ast, AstPtr, SyntaxNodePtr};
|
2019-10-31 18:45:10 +03:00
|
|
|
|
2019-11-28 12:50:26 +03:00
|
|
|
use hir_expand::{HirFileId, InFile};
|
2019-10-31 18:45:10 +03:00
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
pub struct UnresolvedModule {
|
|
|
|
pub file: HirFileId,
|
|
|
|
pub decl: AstPtr<ast::Module>,
|
2020-06-16 18:45:58 +02:00
|
|
|
pub candidate: String,
|
2019-10-31 18:45:10 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Diagnostic for UnresolvedModule {
|
|
|
|
fn message(&self) -> String {
|
|
|
|
"unresolved module".to_string()
|
|
|
|
}
|
2019-11-28 12:50:26 +03:00
|
|
|
fn source(&self) -> InFile<SyntaxNodePtr> {
|
2020-04-17 13:06:02 +02:00
|
|
|
InFile::new(self.file, self.decl.clone().into())
|
2019-10-31 18:45:10 +03:00
|
|
|
}
|
|
|
|
fn as_any(&self) -> &(dyn Any + Send + 'static) {
|
|
|
|
self
|
|
|
|
}
|
|
|
|
}
|