@@ -17,6 +17,7 @@ use std::{
17
17
collections:: HashMap ,
18
18
path:: { Path , PathBuf } ,
19
19
} ;
20
+ use std:: { env, fs} ;
20
21
use tracing:: { error, info, warn} ;
21
22
use tracing_subscriber:: layer:: SubscriberExt ;
22
23
use tracing_subscriber:: util:: SubscriberInitExt ;
@@ -77,17 +78,19 @@ impl<'a> Extractor<'a> {
77
78
}
78
79
let no_location = ( LineCol { line : 0 , col : 0 } , LineCol { line : 0 , col : 0 } ) ;
79
80
if let Err ( reason) = semantics_info {
80
- let message = format ! ( "semantic analyzer unavailable ({reason})" ) ;
81
- let full_message = format ! (
82
- "{message}: macro expansion, call graph, and type inference will be skipped."
83
- ) ;
84
- translator. emit_diagnostic (
85
- trap:: DiagnosticSeverity :: Warning ,
86
- "semantics" . to_owned ( ) ,
87
- message,
88
- full_message,
89
- no_location,
90
- ) ;
81
+ if !reason. is_empty ( ) {
82
+ let message = format ! ( "semantic analyzer unavailable ({reason})" ) ;
83
+ let full_message = format ! (
84
+ "{message}: macro expansion, call graph, and type inference will be skipped."
85
+ ) ;
86
+ translator. emit_diagnostic (
87
+ trap:: DiagnosticSeverity :: Warning ,
88
+ "semantics" . to_owned ( ) ,
89
+ message,
90
+ full_message,
91
+ no_location,
92
+ ) ;
93
+ }
91
94
}
92
95
translator. emit_source_file ( ast) ;
93
96
translator. trap . commit ( ) . unwrap_or_else ( |err| {
@@ -276,5 +279,16 @@ fn main() -> anyhow::Result<()> {
276
279
}
277
280
}
278
281
}
282
+ let builtins_dir = env:: var ( "CODEQL_EXTRACTOR_RUST_ROOT" )
283
+ . map ( |path| Path :: new ( & path) . join ( "tools" ) . join ( "builtins" ) ) ?;
284
+ let builtins = fs:: read_dir ( builtins_dir) . context ( "failed to read builtins directory" ) ?;
285
+ for entry in builtins {
286
+ let entry = entry. context ( "failed to read builtins directory" ) ?;
287
+ let path = entry. path ( ) ;
288
+ if path. extension ( ) . is_some_and ( |ext| ext == "rs" ) {
289
+ extractor. extract_without_semantics ( & path, "" ) ;
290
+ }
291
+ }
292
+
279
293
extractor. emit_extraction_diagnostics ( start, & cfg)
280
294
}
0 commit comments