diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-01-03 21:50:36 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-01-08 16:00:34 +1100 |
| commit | 6682f243dcb9babd67525bbf9798dca302f60588 (patch) | |
| tree | b6342f6aeef783fe40c65a6fa2e34ecf53bd11fe /compiler/rustc_errors/src | |
| parent | bd4e623485f383b478fae662a767a3129bb4b989 (diff) | |
| download | rust-6682f243dcb9babd67525bbf9798dca302f60588.tar.gz rust-6682f243dcb9babd67525bbf9798dca302f60588.zip | |
Remove all eight `DiagnosticBuilder::*_with_code` methods.
These all have relatively low use, and can be perfectly emulated with a simpler construction method combined with `code` or `code_mv`.
Diffstat (limited to 'compiler/rustc_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/diagnostic_builder.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_errors/src/lib.rs | 92 |
2 files changed, 2 insertions, 94 deletions
diff --git a/compiler/rustc_errors/src/diagnostic_builder.rs b/compiler/rustc_errors/src/diagnostic_builder.rs index b3f8a6c2440..dcbf60e4847 100644 --- a/compiler/rustc_errors/src/diagnostic_builder.rs +++ b/compiler/rustc_errors/src/diagnostic_builder.rs @@ -538,11 +538,11 @@ impl<G: EmissionGuarantee> Drop for DiagnosticBuilder<'_, G> { #[macro_export] macro_rules! struct_span_err { ($dcx:expr, $span:expr, $code:ident, $($message:tt)*) => ({ - $dcx.struct_span_err_with_code( + $dcx.struct_span_err( $span, format!($($message)*), - $crate::error_code!($code), ) + .code_mv($crate::error_code!($code)) }) } diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index a63c32566ca..4710722c771 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -732,19 +732,6 @@ impl DiagCtxt { self.struct_warn(msg).span_mv(span) } - /// Construct a builder at the `Warning` level at the given `span` and with the `msg`. - /// Also include a code. - #[rustc_lint_diagnostics] - #[track_caller] - pub fn struct_span_warn_with_code( - &self, - span: impl Into<MultiSpan>, - msg: impl Into<DiagnosticMessage>, - code: DiagnosticId, - ) -> DiagnosticBuilder<'_, ()> { - self.struct_span_warn(span, msg).code_mv(code) - } - /// Construct a builder at the `Warning` level with the `msg`. /// /// Attempting to `.emit()` the builder will only emit if either: @@ -785,18 +772,6 @@ impl DiagCtxt { self.struct_err(msg).span_mv(span) } - /// Construct a builder at the `Error` level at the given `span`, with the `msg`, and `code`. - #[rustc_lint_diagnostics] - #[track_caller] - pub fn struct_span_err_with_code( - &self, - span: impl Into<MultiSpan>, - msg: impl Into<DiagnosticMessage>, - code: DiagnosticId, - ) -> DiagnosticBuilder<'_> { - self.struct_span_err(span, msg).code_mv(code) - } - /// Construct a builder at the `Error` level with the `msg`. // FIXME: This method should be removed (every error should have an associated error code). #[rustc_lint_diagnostics] @@ -805,28 +780,6 @@ impl DiagCtxt { DiagnosticBuilder::new(self, Error, msg) } - /// Construct a builder at the `Error` level with the `msg` and the `code`. - #[rustc_lint_diagnostics] - #[track_caller] - pub fn struct_err_with_code( - &self, - msg: impl Into<DiagnosticMessage>, - code: DiagnosticId, - ) -> DiagnosticBuilder<'_> { - self.struct_err(msg).code_mv(code) - } - - /// Construct a builder at the `Warn` level with the `msg` and the `code`. - #[rustc_lint_diagnostics] - #[track_caller] - pub fn struct_warn_with_code( - &self, - msg: impl Into<DiagnosticMessage>, - code: DiagnosticId, - ) -> DiagnosticBuilder<'_, ()> { - self.struct_warn(msg).code_mv(code) - } - /// Construct a builder at the `Fatal` level at the given `span` and with the `msg`. #[rustc_lint_diagnostics] #[track_caller] @@ -838,18 +791,6 @@ impl DiagCtxt { self.struct_fatal(msg).span_mv(span) } - /// Construct a builder at the `Fatal` level at the given `span`, with the `msg`, and `code`. - #[rustc_lint_diagnostics] - #[track_caller] - pub fn struct_span_fatal_with_code( - &self, - span: impl Into<MultiSpan>, - msg: impl Into<DiagnosticMessage>, - code: DiagnosticId, - ) -> DiagnosticBuilder<'_, FatalAbort> { - self.struct_span_fatal(span, msg).code_mv(code) - } - /// Construct a builder at the `Fatal` level with the `msg`. #[rustc_lint_diagnostics] #[track_caller] @@ -899,17 +840,6 @@ impl DiagCtxt { #[rustc_lint_diagnostics] #[track_caller] - pub fn span_fatal_with_code( - &self, - span: impl Into<MultiSpan>, - msg: impl Into<DiagnosticMessage>, - code: DiagnosticId, - ) -> ! { - self.struct_span_fatal_with_code(span, msg, code).emit() - } - - #[rustc_lint_diagnostics] - #[track_caller] pub fn span_err( &self, span: impl Into<MultiSpan>, @@ -920,32 +850,10 @@ impl DiagCtxt { #[rustc_lint_diagnostics] #[track_caller] - pub fn span_err_with_code( - &self, - span: impl Into<MultiSpan>, - msg: impl Into<DiagnosticMessage>, - code: DiagnosticId, - ) -> ErrorGuaranteed { - self.struct_span_err_with_code(span, msg, code).emit() - } - - #[rustc_lint_diagnostics] - #[track_caller] pub fn span_warn(&self, span: impl Into<MultiSpan>, msg: impl Into<DiagnosticMessage>) { self.struct_span_warn(span, msg).emit() } - #[rustc_lint_diagnostics] - #[track_caller] - pub fn span_warn_with_code( - &self, - span: impl Into<MultiSpan>, - msg: impl Into<DiagnosticMessage>, - code: DiagnosticId, - ) { - self.struct_span_warn_with_code(span, msg, code).emit() - } - pub fn span_bug(&self, span: impl Into<MultiSpan>, msg: impl Into<DiagnosticMessage>) -> ! { self.struct_span_bug(span, msg).emit() } |
