flatten module structure

This commit is contained in:
Aleksey Kladov 2019-01-06 17:33:27 +03:00
parent 5a505189a8
commit fd4456d0ec
13 changed files with 431 additions and 436 deletions

View file

@ -1,7 +1,8 @@
use relative_path::RelativePathBuf;
use ra_db::{CrateId, Cancelable, FileId};
use ra_syntax::{ast, SyntaxNode};
use crate::{Name, db::HirDatabase, DefId, Path, PerNs, module::{Problem, ModuleScope}};
use crate::{Name, db::HirDatabase, DefId, Path, PerNs, nameres::ModuleScope};
/// hir::Crate describes a single crate. It's the main inteface with which
/// crate's dependencies interact. Mostly, it should be just a proxy for the
@ -39,6 +40,17 @@ pub enum ModuleSource {
Module(ast::ModuleNode),
}
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
pub enum Problem {
UnresolvedModule {
candidate: RelativePathBuf,
},
NotDirOwner {
move_to: RelativePathBuf,
candidate: RelativePathBuf,
},
}
impl Module {
/// Name of this module.
pub fn name(&self, db: &impl HirDatabase) -> Cancelable<Option<Name>> {