From 79347f3b8c0e9e3448144d9ecab6b88e95d06b03 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 29 Feb 2024 16:56:24 +1100 Subject: [PATCH] Rename `StructuredDiagnostic` as `StructuredDiag`. --- compiler/rustc_hir_analysis/src/astconv/generics.rs | 2 +- compiler/rustc_hir_analysis/src/structured_errors.rs | 2 +- .../src/structured_errors/missing_cast_for_variadic_arg.rs | 4 ++-- .../src/structured_errors/sized_unsized_cast.rs | 4 ++-- .../src/structured_errors/wrong_number_of_generic_args.rs | 4 ++-- compiler/rustc_hir_typeck/src/cast.rs | 4 +--- compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs | 2 +- 7 files changed, 10 insertions(+), 12 deletions(-) diff --git a/compiler/rustc_hir_analysis/src/astconv/generics.rs b/compiler/rustc_hir_analysis/src/astconv/generics.rs index ce4c4609bc85a..63afa4f7e82d2 100644 --- a/compiler/rustc_hir_analysis/src/astconv/generics.rs +++ b/compiler/rustc_hir_analysis/src/astconv/generics.rs @@ -3,7 +3,7 @@ use crate::astconv::{ errors::prohibit_assoc_ty_binding, CreateInstantiationsForGenericArgsCtxt, ExplicitLateBound, GenericArgCountMismatch, GenericArgCountResult, GenericArgPosition, }; -use crate::structured_errors::{GenericArgsInfo, StructuredDiagnostic, WrongNumberOfGenericArgs}; +use crate::structured_errors::{GenericArgsInfo, StructuredDiag, WrongNumberOfGenericArgs}; use rustc_ast::ast::ParamKindOrd; use rustc_errors::{ codes::*, struct_span_code_err, Applicability, Diag, ErrorGuaranteed, MultiSpan, diff --git a/compiler/rustc_hir_analysis/src/structured_errors.rs b/compiler/rustc_hir_analysis/src/structured_errors.rs index 9064ba8693ef5..5abfd25dd95df 100644 --- a/compiler/rustc_hir_analysis/src/structured_errors.rs +++ b/compiler/rustc_hir_analysis/src/structured_errors.rs @@ -9,7 +9,7 @@ pub use self::{ use rustc_errors::{Diag, ErrCode}; use rustc_session::Session; -pub trait StructuredDiagnostic<'tcx> { +pub trait StructuredDiag<'tcx> { fn session(&self) -> &Session; fn code(&self) -> ErrCode; diff --git a/compiler/rustc_hir_analysis/src/structured_errors/missing_cast_for_variadic_arg.rs b/compiler/rustc_hir_analysis/src/structured_errors/missing_cast_for_variadic_arg.rs index 921cf37155a2e..0e78acbeae2d4 100644 --- a/compiler/rustc_hir_analysis/src/structured_errors/missing_cast_for_variadic_arg.rs +++ b/compiler/rustc_hir_analysis/src/structured_errors/missing_cast_for_variadic_arg.rs @@ -1,4 +1,4 @@ -use crate::{errors, structured_errors::StructuredDiagnostic}; +use crate::{errors, structured_errors::StructuredDiag}; use rustc_errors::{codes::*, Diag}; use rustc_middle::ty::{Ty, TypeVisitableExt}; use rustc_session::Session; @@ -11,7 +11,7 @@ pub struct MissingCastForVariadicArg<'tcx, 's> { pub cast_ty: &'s str, } -impl<'tcx> StructuredDiagnostic<'tcx> for MissingCastForVariadicArg<'tcx, '_> { +impl<'tcx> StructuredDiag<'tcx> for MissingCastForVariadicArg<'tcx, '_> { fn session(&self) -> &Session { self.sess } diff --git a/compiler/rustc_hir_analysis/src/structured_errors/sized_unsized_cast.rs b/compiler/rustc_hir_analysis/src/structured_errors/sized_unsized_cast.rs index 1af5e6a9dfc4b..9e871ff9af01b 100644 --- a/compiler/rustc_hir_analysis/src/structured_errors/sized_unsized_cast.rs +++ b/compiler/rustc_hir_analysis/src/structured_errors/sized_unsized_cast.rs @@ -1,4 +1,4 @@ -use crate::{errors, structured_errors::StructuredDiagnostic}; +use crate::{errors, structured_errors::StructuredDiag}; use rustc_errors::{codes::*, Diag}; use rustc_middle::ty::{Ty, TypeVisitableExt}; use rustc_session::Session; @@ -11,7 +11,7 @@ pub struct SizedUnsizedCast<'tcx> { pub cast_ty: String, } -impl<'tcx> StructuredDiagnostic<'tcx> for SizedUnsizedCast<'tcx> { +impl<'tcx> StructuredDiag<'tcx> for SizedUnsizedCast<'tcx> { fn session(&self) -> &Session { self.sess } diff --git a/compiler/rustc_hir_analysis/src/structured_errors/wrong_number_of_generic_args.rs b/compiler/rustc_hir_analysis/src/structured_errors/wrong_number_of_generic_args.rs index 6f4695ec92005..0f5ba26337a15 100644 --- a/compiler/rustc_hir_analysis/src/structured_errors/wrong_number_of_generic_args.rs +++ b/compiler/rustc_hir_analysis/src/structured_errors/wrong_number_of_generic_args.rs @@ -1,4 +1,4 @@ -use crate::structured_errors::StructuredDiagnostic; +use crate::structured_errors::StructuredDiag; use rustc_errors::{codes::*, pluralize, Applicability, Diag, MultiSpan}; use rustc_hir as hir; use rustc_middle::ty::{self as ty, AssocItems, AssocKind, TyCtxt}; @@ -1097,7 +1097,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { } } -impl<'tcx> StructuredDiagnostic<'tcx> for WrongNumberOfGenericArgs<'_, 'tcx> { +impl<'tcx> StructuredDiag<'tcx> for WrongNumberOfGenericArgs<'_, 'tcx> { fn session(&self) -> &Session { self.tcx.sess } diff --git a/compiler/rustc_hir_typeck/src/cast.rs b/compiler/rustc_hir_typeck/src/cast.rs index 84d042da138f8..b8d1eaee81260 100644 --- a/compiler/rustc_hir_typeck/src/cast.rs +++ b/compiler/rustc_hir_typeck/src/cast.rs @@ -483,9 +483,7 @@ impl<'a, 'tcx> CastCheck<'tcx> { err.emit(); } CastError::SizedUnsizedCast => { - use rustc_hir_analysis::structured_errors::{ - SizedUnsizedCast, StructuredDiagnostic, - }; + use rustc_hir_analysis::structured_errors::{SizedUnsizedCast, StructuredDiag}; SizedUnsizedCast { sess: fcx.tcx.sess, diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs index 1311cc8968af0..e170a1f366a39 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs @@ -27,7 +27,7 @@ use rustc_hir::{ExprKind, Node, QPath}; use rustc_hir_analysis::astconv::AstConv; use rustc_hir_analysis::check::intrinsicck::InlineAsmCtxt; use rustc_hir_analysis::check::potentially_plural_count; -use rustc_hir_analysis::structured_errors::StructuredDiagnostic; +use rustc_hir_analysis::structured_errors::StructuredDiag; use rustc_index::IndexVec; use rustc_infer::infer::error_reporting::{FailureCode, ObligationCauseExt}; use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};