about summary refs log tree commit diff
path: root/compiler/rustc_session
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-03-21 14:54:24 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2024-04-16 13:02:55 +1000
commit9b0ced000a7e9db6bed97046974adfa9bf3bc165 (patch)
tree86a82f50fe78a0af04ed51196ba41c9c563bdbae /compiler/rustc_session
parent62c32aeeab0558123f12a9372768ba567ce43361 (diff)
downloadrust-9b0ced000a7e9db6bed97046974adfa9bf3bc165.tar.gz
rust-9b0ced000a7e9db6bed97046974adfa9bf3bc165.zip
Move `initialize_checked_jobserver`.
Currently it's a method on `EarlyDiagCtxt`, which is not the right place
for it at all -- `EarlyDiagCtxt` is used to issue diagnostics, but
shouldn't be doing any of the actual checking.

This commit moves it into a standalone function that takes an
`EarlyDiagCtxt` as an argument, which is more sensible. This does
require adding `EarlyDiagCtxt::early_struct_warn`, so a warning can be
returned and then modified with a note. (And that likely explains why
somebody put `initialize_checked_jobserver` into `EarlyDiagCtxt` in the
first place.)
Diffstat (limited to 'compiler/rustc_session')
-rw-r--r--compiler/rustc_session/src/session.rs14
1 files changed, 4 insertions, 10 deletions
diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs
index ecf70e0822e..8b844f340e5 100644
--- a/compiler/rustc_session/src/session.rs
+++ b/compiler/rustc_session/src/session.rs
@@ -1397,16 +1397,10 @@ impl EarlyDiagCtxt {
         self.dcx.warn(msg)
     }
 
-    pub fn initialize_checked_jobserver(&self) {
-        // initialize jobserver before getting `jobserver::client` and `build_session`.
-        jobserver::initialize_checked(|err| {
-            #[allow(rustc::untranslatable_diagnostic)]
-            #[allow(rustc::diagnostic_outside_of_impl)]
-            self.dcx
-                .struct_warn(err)
-                .with_note("the build environment is likely misconfigured")
-                .emit()
-        });
+    #[allow(rustc::untranslatable_diagnostic)]
+    #[allow(rustc::diagnostic_outside_of_impl)]
+    pub fn early_struct_warn(&self, msg: impl Into<DiagMessage>) -> Diag<'_, ()> {
+        self.dcx.struct_warn(msg)
     }
 }