Skip to content

feat: exclude refs(find all refs) from deps and stdlib#21906

Merged
ChayimFriedman2 merged 5 commits intorust-lang:masterfrom
Young-Flash:master
Apr 19, 2026
Merged

feat: exclude refs(find all refs) from deps and stdlib#21906
ChayimFriedman2 merged 5 commits intorust-lang:masterfrom
Young-Flash:master

Conversation

@Young-Flash
Copy link
Copy Markdown
Member

follow up #16441, close #17184

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 29, 2026
@Young-Flash Young-Flash changed the title feat: exclude refs from deps and stdlib feat: exclude refs(find all refs) from deps and stdlib Mar 29, 2026
@rustbot

This comment has been minimized.

@ChayimFriedman2
Copy link
Copy Markdown
Contributor

I'm not keen on another config to be honest. I prefer an idea @Veykril has suggested in the past (@Veykril do you agree?): search in dependencies if the search is triggered from dependency source, exclude them if the search is from user code. This seems intuitive.

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 11, 2026

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

Comment thread crates/ide-db/src/search.rs Outdated
/// whether to search for the `self` module
search_self_mod: bool,
/// categories to exclude while collecting usages
excluded_categories: ReferenceCategory,
Copy link
Copy Markdown
Contributor

@ChayimFriedman2 ChayimFriedman2 Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

View changes since the review

I prefer this to be included_categories.

Comment thread crates/ide-db/src/search.rs Outdated
Some(scope) => base.intersection(scope),
}
};
if self.exclude_library_files {
Copy link
Copy Markdown
Contributor

@ChayimFriedman2 ChayimFriedman2 Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

View changes since the review

It's better to do that in scope_files(). This will also handle the case you forgot in short_associated_function_fast_search().

Comment thread crates/ide/src/references.rs Outdated
}
});
})
.filter(|decl| !(exclude_library_refs && is_library_file(sema.db, decl.nav.file_id)));
Copy link
Copy Markdown
Contributor

@ChayimFriedman2 ChayimFriedman2 Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

View changes since the review

No need to do that here given it's already filtered by the search.

FileId(0) 9..12 import
FileId(0) 31..34
"#]],
);
Copy link
Copy Markdown
Contributor

@ChayimFriedman2 ChayimFriedman2 Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

View changes since the review

I think we always want the definition, even when inside a library. Only exclude other references.

Copy link
Copy Markdown
Contributor

@ChayimFriedman2 ChayimFriedman2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue Apr 19, 2026
Merged via the queue into rust-lang:master with commit 82902ef Apr 19, 2026
32 of 34 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: improve references search

3 participants