Rust: add file for root modules of crates

This commit is contained in:
Arthur Baars
2025-03-03 12:34:04 +01:00
parent 8961a22a71
commit 845f002124
3 changed files with 21 additions and 2 deletions

View File

@@ -6,6 +6,7 @@ use chalk_ir::IntTy;
use chalk_ir::Scalar;
use chalk_ir::UintTy;
use chalk_ir::{FloatTy, Safety};
use codeql_extractor::trap::Location;
use itertools::Itertools;
use ra_ap_base_db::CrateGraph;
use ra_ap_base_db::CrateId;
@@ -85,6 +86,22 @@ pub fn extract_crate_graph(trap_provider: &trap::TrapFileProvider, db: &RootData
DefMap::ROOT,
&mut trap,
);
let file_label = trap.emit_file(root_module_file).as_untyped();
let location_label = codeql_extractor::extractor::location_label(
&mut trap.writer,
Location {
file_label,
start_line: 0,
start_column: 0,
end_line: 0,
end_column: 0,
},
);
trap.writer.add_tuple(
"locatable_locations",
vec![module.into(), location_label.into()],
);
let element = generated::Crate {
id: trap::TrapId::Key(format!("{}:{hash}", root_module_file.display())),
name: krate