Skip to content

Conversation

@Aditya-PS-05
Copy link
Contributor

@Aditya-PS-05 Aditya-PS-05 commented Nov 22, 2025

closes #21072

The issue was that only the lib targets with custom paths were added to the source root includes. So binary (and other) targets failed when their path was set to a location outside the cargo package directory.

The fix removes the filter that restricted this behavior to only lib, thus allowing all target types (Bin, Example, Test, etc.) with custom paths to have their parent directories included in source roots.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 22, 2025
@Aditya-PS-05 Aditya-PS-05 changed the title fix: Include all target types with paths outside package root fix: include all target types with paths outside package root Nov 22, 2025
Copy link
Member

Choose a reason for hiding this comment

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

lets sort -> dedup include here as with this change we will likely get duplicates (and I don't trust our vfs code here that it can work well with dupes)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@Veykril
Copy link
Member

Veykril commented Nov 23, 2025

Thanks!

@Veykril Veykril added this pull request to the merge queue Nov 23, 2025
Merged via the queue into rust-lang:master with commit 4a2b38f Nov 23, 2025
15 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 23, 2025
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.

rust-analyzer: module file not found without having crate root open in editor for certain cargo workspace setups

3 participants