9464: fix: Fix runnables using wrong file ids for module doctests r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
bors[bot] 2021-07-02 13:51:57 +00:00 committed by GitHub
commit dd69d4a97c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -360,7 +360,10 @@ fn module_def_doctest(sema: &Semantics<RootDatabase>, def: hir::ModuleDef) -> Op
.map(TestId::Path)
.or_else(|| def_name.clone().map(TestId::Name))?;
let mut nav = def.try_to_nav(sema.db)?;
let mut nav = match def {
hir::ModuleDef::Module(def) => NavigationTarget::from_module_to_decl(sema.db, def),
def => def.try_to_nav(sema.db)?,
};
nav.focus_range = None;
nav.description = None;
nav.docs = None;