mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 15:15:24 +00:00
introduce FromSource trait
This commit is contained in:
parent
c35ef7e1ed
commit
2867c40925
13 changed files with 294 additions and 138 deletions
|
@ -63,7 +63,9 @@ fn runnable_mod(db: &RootDatabase, file_id: FileId, module: ast::Module) -> Opti
|
|||
return None;
|
||||
}
|
||||
let range = module.syntax().text_range();
|
||||
let module = hir::source_binder::module_from_child_node(db, file_id, module.syntax())?;
|
||||
let src = hir::ModuleSource::from_child_node(db, file_id, &module.syntax());
|
||||
let module =
|
||||
hir::Module::from_definition(db, hir::Source { file_id: file_id.into(), ast: src })?;
|
||||
|
||||
let path = module.path_to_root(db).into_iter().rev().filter_map(|it| it.name(db)).join("::");
|
||||
Some(Runnable { range, kind: RunnableKind::TestMod { path } })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue