Closed
Description
.., but I would say this is a significant architectural bug.
By design, this layer of rust-analyzer knows nothing about cargo specific concepts. dev-vs-build-vs normal is 100% Cargo concept. rustc
knows nothing about these words. As such, any special handling of these concepts should happen in workspace.rs
, not here.
The motivation for this design is two-fold:
- practically, Cargo is a build system, there might be others. In the core analysis parts, we shouldn't be prioritizing Cargo over other (current and future) build systems
- theoretically, it is important that the internal objects in rust-analyzer's semantic model reflect the physical reality of rustc. In that physical reality, cargo packages do not exists (and
-dev
as a concept applies to a package), there are only units of compilation.
Originally posted by @matklad in #15754 (comment)