diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-11-20 15:09:05 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-11-22 13:22:49 +1100 |
| commit | 971010ea5a8635dc55ad436c785bb1efe3a67cdd (patch) | |
| tree | 5c67de95e67a91d6af53505bdefe65d0b8ff94f4 /compiler/rustc_interface/src/queries.rs | |
| parent | 3a4798c92d5ea9e4a3a0e6d4e2b597b0e9c7cf9a (diff) | |
| download | rust-971010ea5a8635dc55ad436c785bb1efe3a67cdd.tar.gz rust-971010ea5a8635dc55ad436c785bb1efe3a67cdd.zip | |
Merge `Queries::{ongoing_codegen,linker}`.
There is no real need for them to be separate.
Diffstat (limited to 'compiler/rustc_interface/src/queries.rs')
| -rw-r--r-- | compiler/rustc_interface/src/queries.rs | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/compiler/rustc_interface/src/queries.rs b/compiler/rustc_interface/src/queries.rs index 9fb9778cd56..1c65cf19cde 100644 --- a/compiler/rustc_interface/src/queries.rs +++ b/compiler/rustc_interface/src/queries.rs @@ -180,22 +180,6 @@ impl<'tcx> Queries<'tcx> { }) } - pub fn ongoing_codegen(&'tcx self) -> Result<Box<dyn Any>> { - self.global_ctxt()?.enter(|tcx| { - // Don't do code generation if there were any errors - self.compiler.sess.compile_status()?; - - // If we have any delayed bugs, for example because we created TyKind::Error earlier, - // it's likely that codegen will only cause more ICEs, obscuring the original problem - self.compiler.sess.diagnostic().flush_delayed(); - - // Hook for UI tests. - Self::check_for_rustc_errors_attr(tcx); - - Ok(passes::start_codegen(&*self.compiler.codegen_backend, tcx)) - }) - } - /// Check for the `#[rustc_error]` annotation, which forces an error in codegen. This is used /// to write UI tests that actually test that compilation succeeds without reporting /// an error. @@ -230,8 +214,20 @@ impl<'tcx> Queries<'tcx> { } } - pub fn linker(&'tcx self, ongoing_codegen: Box<dyn Any>) -> Result<Linker> { + pub fn codegen_and_build_linker(&'tcx self) -> Result<Linker> { self.global_ctxt()?.enter(|tcx| { + // Don't do code generation if there were any errors + self.compiler.sess.compile_status()?; + + // If we have any delayed bugs, for example because we created TyKind::Error earlier, + // it's likely that codegen will only cause more ICEs, obscuring the original problem + self.compiler.sess.diagnostic().flush_delayed(); + + // Hook for UI tests. + Self::check_for_rustc_errors_attr(tcx); + + let ongoing_codegen = passes::start_codegen(&*self.compiler.codegen_backend, tcx); + Ok(Linker { dep_graph: tcx.dep_graph.clone(), output_filenames: tcx.output_filenames(()).clone(), |
