about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src/errors.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-12-24 05:19:43 +0000
committerbors <bors@rust-lang.org>2023-12-24 05:19:43 +0000
commit1754946b3ed693834bb79760169e528277fd98d2 (patch)
treeb3d97623b0f43b549734a6730ef55f0adf29dbea /compiler/rustc_hir_analysis/src/errors.rs
parent2c7e0fd373ae8f7d8c5aee1c0ec8e3249e3f3649 (diff)
parent29f25ee3f381922b39a67089bb07d70bfbe2f17e (diff)
downloadrust-1754946b3ed693834bb79760169e528277fd98d2.tar.gz
rust-1754946b3ed693834bb79760169e528277fd98d2.zip
Auto merge of #3238 - rust-lang:rustup-2023-12-24, r=saethlin
Automatic Rustup
Diffstat (limited to 'compiler/rustc_hir_analysis/src/errors.rs')
-rw-r--r--compiler/rustc_hir_analysis/src/errors.rs16
1 files changed, 7 insertions, 9 deletions
diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs
index f461b6a94ec..41f30057902 100644
--- a/compiler/rustc_hir_analysis/src/errors.rs
+++ b/compiler/rustc_hir_analysis/src/errors.rs
@@ -2,8 +2,8 @@
 
 use crate::fluent_generated as fluent;
 use rustc_errors::{
-    error_code, Applicability, DiagCtxt, DiagnosticBuilder, ErrorGuaranteed, IntoDiagnostic,
-    MultiSpan,
+    error_code, Applicability, DiagCtxt, DiagnosticBuilder, EmissionGuarantee, IntoDiagnostic,
+    Level, MultiSpan,
 };
 use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
 use rustc_middle::ty::Ty;
@@ -315,14 +315,12 @@ pub struct MissingTypeParams {
 }
 
 // Manual implementation of `IntoDiagnostic` to be able to call `span_to_snippet`.
-impl<'a> IntoDiagnostic<'a> for MissingTypeParams {
+impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for MissingTypeParams {
     #[track_caller]
-    fn into_diagnostic(self, dcx: &'a DiagCtxt) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
-        let mut err = dcx.struct_span_err_with_code(
-            self.span,
-            fluent::hir_analysis_missing_type_params,
-            error_code!(E0393),
-        );
+    fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'a, G> {
+        let mut err = DiagnosticBuilder::new(dcx, level, fluent::hir_analysis_missing_type_params);
+        err.set_span(self.span);
+        err.code(error_code!(E0393));
         err.set_arg("parameterCount", self.missing_type_params.len());
         err.set_arg(
             "parameters",