From 59eec29e1b59e41e8ed55210ad4155ea43d650d0 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Fri, 2 Jul 2021 15:43:47 +0200 Subject: [PATCH] Fix runnables using wrong file ids for module doctests --- crates/ide/src/runnables.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/ide/src/runnables.rs b/crates/ide/src/runnables.rs index 1b731584e03..98c5b4689a7 100644 --- a/crates/ide/src/runnables.rs +++ b/crates/ide/src/runnables.rs @@ -360,7 +360,10 @@ fn module_def_doctest(sema: &Semantics, 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;