Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit b107ab8

Browse files
committed
Rename EarlyDiagCtxt::handler as EarlyDiagCtxt::dcx.
1 parent 20cb12e commit b107ab8

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

compiler/rustc_session/src/session.rs

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1727,52 +1727,52 @@ enum IncrCompSession {
17271727

17281728
/// A wrapper around an [`DiagCtxt`] that is used for early error emissions.
17291729
pub struct EarlyDiagCtxt {
1730-
handler: DiagCtxt,
1730+
dcx: DiagCtxt,
17311731
}
17321732

17331733
impl EarlyDiagCtxt {
17341734
pub fn new(output: ErrorOutputType) -> Self {
17351735
let emitter = mk_emitter(output);
1736-
Self { handler: DiagCtxt::with_emitter(emitter) }
1736+
Self { dcx: DiagCtxt::with_emitter(emitter) }
17371737
}
17381738

17391739
pub fn abort_if_errors(&self) {
1740-
self.handler.abort_if_errors()
1740+
self.dcx.abort_if_errors()
17411741
}
17421742

1743-
/// Swap out the underlying handler once we acquire the user's preference on error emission
1743+
/// Swap out the underlying dcx once we acquire the user's preference on error emission
17441744
/// format. Any errors prior to that will cause an abort and all stashed diagnostics of the
1745-
/// previous handler will be emitted.
1745+
/// previous dcx will be emitted.
17461746
pub fn abort_if_error_and_set_error_format(&mut self, output: ErrorOutputType) {
1747-
self.handler.abort_if_errors();
1747+
self.dcx.abort_if_errors();
17481748

17491749
let emitter = mk_emitter(output);
1750-
self.handler = DiagCtxt::with_emitter(emitter);
1750+
self.dcx = DiagCtxt::with_emitter(emitter);
17511751
}
17521752

17531753
#[allow(rustc::untranslatable_diagnostic)]
17541754
#[allow(rustc::diagnostic_outside_of_impl)]
17551755
pub fn early_note(&self, msg: impl Into<DiagnosticMessage>) {
1756-
self.handler.struct_note(msg).emit()
1756+
self.dcx.struct_note(msg).emit()
17571757
}
17581758

17591759
#[allow(rustc::untranslatable_diagnostic)]
17601760
#[allow(rustc::diagnostic_outside_of_impl)]
17611761
pub fn early_help(&self, msg: impl Into<DiagnosticMessage>) {
1762-
self.handler.struct_help(msg).emit()
1762+
self.dcx.struct_help(msg).emit()
17631763
}
17641764

17651765
#[allow(rustc::untranslatable_diagnostic)]
17661766
#[allow(rustc::diagnostic_outside_of_impl)]
17671767
#[must_use = "ErrorGuaranteed must be returned from `run_compiler` in order to exit with a non-zero status code"]
17681768
pub fn early_error_no_abort(&self, msg: impl Into<DiagnosticMessage>) -> ErrorGuaranteed {
1769-
self.handler.struct_err(msg).emit()
1769+
self.dcx.struct_err(msg).emit()
17701770
}
17711771

17721772
#[allow(rustc::untranslatable_diagnostic)]
17731773
#[allow(rustc::diagnostic_outside_of_impl)]
17741774
pub fn early_error(&self, msg: impl Into<DiagnosticMessage>) -> ! {
1775-
self.handler.struct_fatal(msg).emit()
1775+
self.dcx.struct_fatal(msg).emit()
17761776
}
17771777

17781778
#[allow(rustc::untranslatable_diagnostic)]
@@ -1781,24 +1781,21 @@ impl EarlyDiagCtxt {
17811781
&self,
17821782
msg: impl Into<DiagnosticMessage>,
17831783
) -> DiagnosticBuilder<'_, !> {
1784-
self.handler.struct_fatal(msg)
1784+
self.dcx.struct_fatal(msg)
17851785
}
17861786

17871787
#[allow(rustc::untranslatable_diagnostic)]
17881788
#[allow(rustc::diagnostic_outside_of_impl)]
17891789
pub fn early_warn(&self, msg: impl Into<DiagnosticMessage>) {
1790-
self.handler.struct_warn(msg).emit()
1790+
self.dcx.struct_warn(msg).emit()
17911791
}
17921792

17931793
pub fn initialize_checked_jobserver(&self) {
17941794
// initialize jobserver before getting `jobserver::client` and `build_session`.
17951795
jobserver::initialize_checked(|err| {
17961796
#[allow(rustc::untranslatable_diagnostic)]
17971797
#[allow(rustc::diagnostic_outside_of_impl)]
1798-
self.handler
1799-
.struct_warn(err)
1800-
.note("the build environment is likely misconfigured")
1801-
.emit()
1798+
self.dcx.struct_warn(err).note("the build environment is likely misconfigured").emit()
18021799
});
18031800
}
18041801
}

0 commit comments

Comments
 (0)