(
&mut self,
compiler: &rustc_interface::interface::Compiler,
tcx: TyCtxt<'_>,
)
| 61 | compiler: &rustc_interface::interface::Compiler, |
| 62 | tcx: TyCtxt<'_>, |
| 63 | ) -> rustc_driver::Compilation { |
| 64 | compiler.sess.dcx().abort_if_errors(); |
| 65 | if self |
| 66 | .output_directory |
| 67 | .to_str() |
| 68 | .expect("valid string") |
| 69 | .contains("/build/") |
| 70 | { |
| 71 | // No need to analyze a build script, but do generate code. |
| 72 | return Compilation::Continue; |
| 73 | } |
| 74 | self.analyze_with_lockbud(compiler, tcx); |
| 75 | if self.test_run { |
| 76 | // We avoid code gen for test cases because LLVM is not used in a thread safe manner. |
| 77 | Compilation::Stop |
| 78 | } else { |
| 79 | // Although LockBud is only a checker, cargo still needs code generation to work. |
| 80 | Compilation::Continue |
| 81 | } |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | impl LockBudCallbacks { |
| 86 | fn analyze_with_lockbud<'tcx>(&mut self, _compiler: &interface::Compiler, tcx: TyCtxt<'tcx>) { |
| 87 | // Skip crates by names (white or black list). |
| 88 | let crate_name = tcx.crate_name(LOCAL_CRATE).to_string(); |
| 89 | match &self.options.crate_name_list { |
nothing calls this directly
no test coverage detected