mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-14 06:03:58 +00:00
3c72fc0573
Anchoring to the SourceRoot wont' work if the path is absolute: #[path = "/tmp/foo.rs"] mod foo; Anchoring to a file will. However, we *should* anchor, instead of just producing an abs path. I can imagine a situation where, for example, rust-analyzer processes crates from different machines (or, for example, from in-memory git branch), where the same absolute path in different crates might refer to different files in the end!
27 lines
627 B
Rust
27 lines
627 B
Rust
//! Diagnostics produced by `hir_def`.
|
|
|
|
use std::any::Any;
|
|
|
|
use hir_expand::diagnostics::Diagnostic;
|
|
use ra_syntax::{ast, AstPtr, SyntaxNodePtr};
|
|
|
|
use hir_expand::{HirFileId, InFile};
|
|
|
|
#[derive(Debug)]
|
|
pub struct UnresolvedModule {
|
|
pub file: HirFileId,
|
|
pub decl: AstPtr<ast::Module>,
|
|
pub candidate: String,
|
|
}
|
|
|
|
impl Diagnostic for UnresolvedModule {
|
|
fn message(&self) -> String {
|
|
"unresolved module".to_string()
|
|
}
|
|
fn source(&self) -> InFile<SyntaxNodePtr> {
|
|
InFile::new(self.file, self.decl.clone().into())
|
|
}
|
|
fn as_any(&self) -> &(dyn Any + Send + 'static) {
|
|
self
|
|
}
|
|
}
|