Rust: extract crate graph

This commit is contained in:
Arthur Baars
2024-11-29 15:31:33 +01:00
parent 75ca04f3dd
commit e21a7f5336
5 changed files with 1315 additions and 2 deletions

2
Cargo.lock generated
View File

@@ -409,6 +409,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"argfile", "argfile",
"chalk-ir",
"chrono", "chrono",
"clap", "clap",
"codeql-extractor", "codeql-extractor",
@@ -422,6 +423,7 @@ dependencies = [
"ra_ap_hir", "ra_ap_hir",
"ra_ap_hir_def", "ra_ap_hir_def",
"ra_ap_hir_expand", "ra_ap_hir_expand",
"ra_ap_hir_ty",
"ra_ap_ide_db", "ra_ap_ide_db",
"ra_ap_intern", "ra_ap_intern",
"ra_ap_load-cargo", "ra_ap_load-cargo",

View File

@@ -14,6 +14,7 @@ ra_ap_base_db = "0.0.266"
ra_ap_hir = "0.0.266" ra_ap_hir = "0.0.266"
ra_ap_hir_def = "0.0.266" ra_ap_hir_def = "0.0.266"
ra_ap_ide_db = "0.0.266" ra_ap_ide_db = "0.0.266"
ra_ap_hir_ty = "0.0.266"
ra_ap_hir_expand = "0.0.266" ra_ap_hir_expand = "0.0.266"
ra_ap_load-cargo = "0.0.266" ra_ap_load-cargo = "0.0.266"
ra_ap_paths = "0.0.266" ra_ap_paths = "0.0.266"
@@ -39,3 +40,4 @@ toml = "0.8.20"
tracing = "0.1.41" tracing = "0.1.41"
tracing-flame = "0.2.0" tracing-flame = "0.2.0"
tracing-subscriber = "0.3.19" tracing-subscriber = "0.3.19"
chalk-ir = "0.99.0"

File diff suppressed because it is too large Load Diff

View File

@@ -22,6 +22,7 @@ use tracing_subscriber::util::SubscriberInitExt;
mod archive; mod archive;
mod config; mod config;
mod crate_graph;
mod diagnostics; mod diagnostics;
pub mod generated; pub mod generated;
mod qltest; mod qltest;
@@ -243,6 +244,7 @@ fn main() -> anyhow::Result<()> {
if let Some((ref db, ref vfs)) = if let Some((ref db, ref vfs)) =
extractor.load_manifest(manifest, &cargo_config, &load_cargo_config) extractor.load_manifest(manifest, &cargo_config, &load_cargo_config)
{ {
crate_graph::extract_crate_graph(extractor.traps, db, vfs);
let semantics = Semantics::new(db); let semantics = Semantics::new(db);
for file in files { for file in files {
match extractor.load_source(file, &semantics, vfs) { match extractor.load_source(file, &semantics, vfs) {

View File

@@ -74,7 +74,7 @@ macro_rules! trap_key {
$( $(
key.push_str(&$x.as_key_part()); key.push_str(&$x.as_key_part());
)* )*
$crate::TrapId::Key(key) trap::TrapId::Key(key)
}}; }};
} }
@@ -123,7 +123,7 @@ impl<T: TrapClass> From<Label<T>> for trap::Arg {
} }
pub struct TrapFile { pub struct TrapFile {
path: PathBuf, pub path: PathBuf,
pub writer: Writer, pub writer: Writer,
compression: Compression, compression: Compression,
} }