Skip to content

Commit b6e6d5d

Browse files
committed
internal: Consider all kinds of explicit private imports in find_path
1 parent d5366b5 commit b6e6d5d

File tree

15 files changed

+212
-224
lines changed

15 files changed

+212
-224
lines changed

crates/base-db/src/lib.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ mod change;
77

88
use std::panic;
99

10-
use rustc_hash::FxHashSet;
1110
use syntax::{ast, Parse, SourceFile};
1211
use triomphe::Arc;
1312

@@ -90,15 +89,16 @@ pub trait SourceDatabaseExt: SourceDatabase {
9089

9190
fn source_root_crates(db: &dyn SourceDatabaseExt, id: SourceRootId) -> Arc<[CrateId]> {
9291
let graph = db.crate_graph();
93-
graph
92+
let mut crates = graph
9493
.iter()
9594
.filter(|&krate| {
9695
let root_file = graph[krate].root_file_id;
9796
db.file_source_root(root_file) == id
9897
})
99-
.collect::<FxHashSet<_>>()
100-
.into_iter()
101-
.collect()
98+
.collect::<Vec<_>>();
99+
crates.sort();
100+
crates.dedup();
101+
crates.into_iter().collect()
102102
}
103103

104104
/// Silly workaround for cyclic deps between the traits

crates/hir-def/src/body/lower.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -965,11 +965,10 @@ impl ExprCollector<'_> {
965965

966966
let res = match self.def_map.modules[module]
967967
.scope
968-
.macro_invocations
969-
.get(&InFile::new(outer_file, self.ast_id_map.ast_id_for_ptr(syntax_ptr)))
968+
.macro_invoc(InFile::new(outer_file, self.ast_id_map.ast_id_for_ptr(syntax_ptr)))
970969
{
971970
// fast path, macro call is in a block module
972-
Some(&call) => Ok(self.expander.enter_expand_id(self.db, call)),
971+
Some(call) => Ok(self.expander.enter_expand_id(self.db, call)),
973972
None => self.expander.enter_expand(self.db, mcall, |path| {
974973
self.def_map
975974
.resolve_path(

crates/hir-def/src/child_by_source.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ impl ChildBySource for ItemScope {
9292
self.impls().for_each(|imp| add_impl(db, res, file_id, imp));
9393
self.extern_crate_decls().for_each(|ext| add_extern_crate(db, res, file_id, ext));
9494
self.use_decls().for_each(|ext| add_use(db, res, file_id, ext));
95-
self.unnamed_consts().for_each(|konst| {
95+
self.unnamed_consts(db).for_each(|konst| {
9696
let loc = konst.lookup(db);
9797
if loc.id.file_id() == file_id {
9898
res[keys::CONST].insert(loc.source(db).value, konst);

0 commit comments

Comments
 (0)