From 89ea7438c693ac279f77dc31ca9ac30d0c5e4f93 Mon Sep 17 00:00:00 2001 From: LIU JIE Date: Mon, 24 Jun 2024 17:28:49 +0800 Subject: [PATCH] fix: collect naming infos for fields and variants for which item used (#258) --- pilota-build/src/middle/context.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pilota-build/src/middle/context.rs b/pilota-build/src/middle/context.rs index 575573e3..c07551bb 100644 --- a/pilota-build/src/middle/context.rs +++ b/pilota-build/src/middle/context.rs @@ -353,7 +353,11 @@ impl ContextBuilder { let mut map: FxHashMap> = FxHashMap::default(); cx.nodes().iter().for_each(|(def_id, node)| { if let Mode::Workspace(_) = &*cx.mode { - if !cx.location_map.contains_key(def_id) { + let mut item_def_id = *def_id; + while !matches!(cx.node(item_def_id).unwrap().kind, NodeKind::Item(_)) { + item_def_id = cx.node(item_def_id).unwrap().parent.unwrap() + } + if !cx.location_map.contains_key(&item_def_id) { return; } }