Skip to content

internal: Consider all kinds of explicit private imports in find_path #16347

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions crates/base-db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ mod change;

use std::panic;

use rustc_hash::FxHashSet;
use syntax::{ast, Parse, SourceFile};
use triomphe::Arc;

Expand Down Expand Up @@ -90,15 +89,16 @@ pub trait SourceDatabaseExt: SourceDatabase {

fn source_root_crates(db: &dyn SourceDatabaseExt, id: SourceRootId) -> Arc<[CrateId]> {
let graph = db.crate_graph();
graph
let mut crates = graph
.iter()
.filter(|&krate| {
let root_file = graph[krate].root_file_id;
db.file_source_root(root_file) == id
})
.collect::<FxHashSet<_>>()
.into_iter()
.collect()
.collect::<Vec<_>>();
crates.sort();
crates.dedup();
crates.into_iter().collect()
}

/// Silly workaround for cyclic deps between the traits
Expand Down
5 changes: 2 additions & 3 deletions crates/hir-def/src/body/lower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -965,11 +965,10 @@ impl ExprCollector<'_> {

let res = match self.def_map.modules[module]
.scope
.macro_invocations
.get(&InFile::new(outer_file, self.ast_id_map.ast_id_for_ptr(syntax_ptr)))
.macro_invoc(InFile::new(outer_file, self.ast_id_map.ast_id_for_ptr(syntax_ptr)))
{
// fast path, macro call is in a block module
Some(&call) => Ok(self.expander.enter_expand_id(self.db, call)),
Some(call) => Ok(self.expander.enter_expand_id(self.db, call)),
None => self.expander.enter_expand(self.db, mcall, |path| {
self.def_map
.resolve_path(
Expand Down
2 changes: 1 addition & 1 deletion crates/hir-def/src/child_by_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl ChildBySource for ItemScope {
self.impls().for_each(|imp| add_impl(db, res, file_id, imp));
self.extern_crate_decls().for_each(|ext| add_extern_crate(db, res, file_id, ext));
self.use_decls().for_each(|ext| add_use(db, res, file_id, ext));
self.unnamed_consts().for_each(|konst| {
self.unnamed_consts(db).for_each(|konst| {
let loc = konst.lookup(db);
if loc.id.file_id() == file_id {
res[keys::CONST].insert(loc.source(db).value, konst);
Expand Down
Loading