Skip to content

Spurious "does not belong to a cargo project" when files are cfg'd out #15998

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

Open
RalfJung opened this issue Dec 1, 2023 · 2 comments
Open
Labels
C-bug Category: bug

Comments

@RalfJung
Copy link
Member

RalfJung commented Dec 1, 2023

When a file is opened that belongs to a project but iscfg-disabled on the current configuration, RA shows a warning:

"This rust file does not belong to a loaded cargo project. It looks like it might belong to the workspace at /home/r/src/rust/compiler-builtins/Cargo.toml, do you want to add it to the linked Projects?"

However clicking the "yes" button does not help; it will add the project and then still show the same warning again next time. It will even show the warning when that exact project file has already been added, or when it is the "root" project file that is added by default when the list is empty.

This is easily reproduced for instance in the compiler-builtins crate, in files like src/mem/impls.rs or src/arm_linux.rs.

Maybe it would make sense to do a quick check whether the Cargo.toml file it suggests is already loaded, and only show the warning when it is not?

rust-analyzer version: rust-analyzer version: 0.3.1748-standalone

rustc version: rustc 1.76.0-nightly (b10cfcd65 2023-11-29)

relevant settings: -

@RalfJung RalfJung added the C-bug Category: bug label Dec 1, 2023
@RalfJung
Copy link
Member Author

@Veykril so this should be closed I guess if the notification does not appear any more?
OTOH, the bug in "untracked files" tracking may still be present and it seems worth keeping a record of that somewhere.

@Veykril
Copy link
Member

Veykril commented Jun 13, 2024

Let's keep this open and cross link to #17397 for now until we figure the situation out here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants