Expand description
In rust-analyzer, we maintain a strict separation between pure abstract semantic project model and a concrete model of a particular build system.
Pure model is represented by the base_db::CrateGraph
from another crate.
In this crate, we are concerned with “real world” project models.
Specifically, here we have a representation for a Cargo project
(CargoWorkspace
) and for manually specified layout (ProjectJson
).
Roughly, the things we do here are:
- Project discovery (where’s the relevant Cargo.toml for the current dir).
- Custom build steps (
build.rs
code generation and compilation of procedural macros). - Lowering of concrete model to a
base_db::CrateGraph
Re-exports§
pub use crate::project_json::ProjectJson;
pub use crate::project_json::ProjectJsonData;
Modules§
rust-project.json
file format.- Runs
rustc --print target-spec-json
to get the target_data_layout.
Structs§
CargoWorkspace
represents the logical structure of, well, a Cargo workspace. It pretty closely mirrorscargo metadata
output.- A set of cfg-overrides per crate.
- More or less
AbsPathBuf
with non-None parent. - Starting point for metadata returned by
cargo metadata
- Information associated with a cargo crate
PackageRoot
describes a package root folder. Which may be an external dependency, or a member of the current workspace.- Information associated with a package’s target
- Output of the build script and proc-macro building steps for a workspace.
Enums§
- Describes how to set the rustc source directory.