1
Fork 0

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.)
This commit is contained in:
Nicholas Nethercote 2024-03-21 14:54:24 +11:00
parent 62c32aeeab
commit 9b0ced000a
3 changed files with 20 additions and 13 deletions

View file

@ -1,5 +1,5 @@
#![allow(rustc::bad_opt_access)]
use crate::interface::parse_cfg;
use crate::interface::{initialize_checked_jobserver, parse_cfg};
use rustc_data_structures::profiling::TimePassesFormat;
use rustc_errors::{emitter::HumanReadableErrorType, registry, ColorConfig};
use rustc_session::config::{
@ -31,7 +31,7 @@ where
F: FnOnce(Session, Cfg),
{
let mut early_dcx = EarlyDiagCtxt::new(ErrorOutputType::default());
early_dcx.initialize_checked_jobserver();
initialize_checked_jobserver(&early_dcx);
let matches = optgroups().parse(args).unwrap();
let sessopts = build_session_options(&mut early_dcx, &matches);