Rename IntoDiagnosticArg
as IntoDiagArg
.
Also rename `into_diagnostic_arg` as `into_diag_arg`, and `NotIntoDiagnosticArg` as `NotInotDiagArg`.
This commit is contained in:
parent
256d802233
commit
a09b1d33a7
38 changed files with 218 additions and 219 deletions
|
@ -6,7 +6,7 @@ use crate::ty::{layout, tls, Ty, TyCtxt, ValTree};
|
|||
|
||||
use rustc_ast_ir::Mutability;
|
||||
use rustc_data_structures::sync::Lock;
|
||||
use rustc_errors::{DiagArgName, DiagArgValue, DiagMessage, ErrorGuaranteed, IntoDiagnosticArg};
|
||||
use rustc_errors::{DiagArgName, DiagArgValue, DiagMessage, ErrorGuaranteed, IntoDiagArg};
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_session::CtfeBacktrace;
|
||||
use rustc_span::{def_id::DefId, Span, DUMMY_SP};
|
||||
|
@ -234,8 +234,8 @@ pub enum InvalidMetaKind {
|
|||
TooBig,
|
||||
}
|
||||
|
||||
impl IntoDiagnosticArg for InvalidMetaKind {
|
||||
fn into_diagnostic_arg(self) -> DiagArgValue {
|
||||
impl IntoDiagArg for InvalidMetaKind {
|
||||
fn into_diag_arg(self) -> DiagArgValue {
|
||||
DiagArgValue::Str(Cow::Borrowed(match self {
|
||||
InvalidMetaKind::SliceTooBig => "slice_too_big",
|
||||
InvalidMetaKind::TooBig => "too_big",
|
||||
|
@ -266,10 +266,10 @@ pub struct Misalignment {
|
|||
pub required: Align,
|
||||
}
|
||||
|
||||
macro_rules! impl_into_diagnostic_arg_through_debug {
|
||||
macro_rules! impl_into_diag_arg_through_debug {
|
||||
($($ty:ty),*$(,)?) => {$(
|
||||
impl IntoDiagnosticArg for $ty {
|
||||
fn into_diagnostic_arg(self) -> DiagArgValue {
|
||||
impl IntoDiagArg for $ty {
|
||||
fn into_diag_arg(self) -> DiagArgValue {
|
||||
DiagArgValue::Str(Cow::Owned(format!("{self:?}")))
|
||||
}
|
||||
}
|
||||
|
@ -277,7 +277,7 @@ macro_rules! impl_into_diagnostic_arg_through_debug {
|
|||
}
|
||||
|
||||
// These types have nice `Debug` output so we can just use them in diagnostics.
|
||||
impl_into_diagnostic_arg_through_debug! {
|
||||
impl_into_diag_arg_through_debug! {
|
||||
AllocId,
|
||||
Pointer<AllocId>,
|
||||
AllocRange,
|
||||
|
@ -370,8 +370,8 @@ pub enum PointerKind {
|
|||
Box,
|
||||
}
|
||||
|
||||
impl IntoDiagnosticArg for PointerKind {
|
||||
fn into_diagnostic_arg(self) -> DiagArgValue {
|
||||
impl IntoDiagArg for PointerKind {
|
||||
fn into_diag_arg(self) -> DiagArgValue {
|
||||
DiagArgValue::Str(
|
||||
match self {
|
||||
Self::Ref(_) => "ref",
|
||||
|
|
|
@ -100,7 +100,7 @@ macro_rules! err_ub_custom {
|
|||
msg: || $msg,
|
||||
add_args: Box::new(move |mut set_arg| {
|
||||
$($(
|
||||
set_arg(stringify!($name).into(), rustc_errors::IntoDiagnosticArg::into_diagnostic_arg($name));
|
||||
set_arg(stringify!($name).into(), rustc_errors::IntoDiagArg::into_diag_arg($name));
|
||||
)*)?
|
||||
})
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ use crate::ty::{AdtDef, InstanceDef, UserTypeAnnotationIndex};
|
|||
use crate::ty::{GenericArg, GenericArgsRef};
|
||||
|
||||
use rustc_data_structures::captures::Captures;
|
||||
use rustc_errors::{DiagArgName, DiagArgValue, DiagMessage, ErrorGuaranteed, IntoDiagnosticArg};
|
||||
use rustc_errors::{DiagArgName, DiagArgValue, DiagMessage, ErrorGuaranteed, IntoDiagArg};
|
||||
use rustc_hir::def::{CtorKind, Namespace};
|
||||
use rustc_hir::def_id::{DefId, CRATE_DEF_ID};
|
||||
use rustc_hir::{self, CoroutineDesugaring, CoroutineKind, ImplicitSelfKind};
|
||||
|
|
|
@ -311,7 +311,7 @@ impl<O> AssertKind<O> {
|
|||
|
||||
macro_rules! add {
|
||||
($name: expr, $value: expr) => {
|
||||
adder($name.into(), $value.into_diagnostic_arg());
|
||||
adder($name.into(), $value.into_diag_arg());
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
//! [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/thir.html
|
||||
|
||||
use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
|
||||
use rustc_errors::{DiagArgValue, IntoDiagnosticArg};
|
||||
use rustc_errors::{DiagArgValue, IntoDiagArg};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::RangeEnd;
|
||||
|
@ -676,9 +676,9 @@ impl<'tcx> Pat<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx> IntoDiagnosticArg for Pat<'tcx> {
|
||||
fn into_diagnostic_arg(self) -> DiagArgValue {
|
||||
format!("{self}").into_diagnostic_arg()
|
||||
impl<'tcx> IntoDiagArg for Pat<'tcx> {
|
||||
fn into_diag_arg(self) -> DiagArgValue {
|
||||
format!("{self}").into_diag_arg()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use rustc_apfloat::ieee::{Double, Single};
|
||||
use rustc_apfloat::Float;
|
||||
use rustc_errors::{DiagArgValue, IntoDiagnosticArg};
|
||||
use rustc_errors::{DiagArgValue, IntoDiagArg};
|
||||
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
|
||||
use rustc_target::abi::Size;
|
||||
use std::fmt;
|
||||
|
@ -114,10 +114,10 @@ impl std::fmt::Debug for ConstInt {
|
|||
}
|
||||
}
|
||||
|
||||
impl IntoDiagnosticArg for ConstInt {
|
||||
impl IntoDiagArg for ConstInt {
|
||||
// FIXME this simply uses the Debug impl, but we could probably do better by converting both
|
||||
// to an inherent method that returns `Cow`.
|
||||
fn into_diagnostic_arg(self) -> DiagArgValue {
|
||||
fn into_diag_arg(self) -> DiagArgValue {
|
||||
DiagArgValue::Str(format!("{self:?}").into())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,9 +14,9 @@ pub struct UnevaluatedConst<'tcx> {
|
|||
pub args: GenericArgsRef<'tcx>,
|
||||
}
|
||||
|
||||
impl rustc_errors::IntoDiagnosticArg for UnevaluatedConst<'_> {
|
||||
fn into_diagnostic_arg(self) -> rustc_errors::DiagArgValue {
|
||||
format!("{self:?}").into_diagnostic_arg()
|
||||
impl rustc_errors::IntoDiagArg for UnevaluatedConst<'_> {
|
||||
fn into_diag_arg(self) -> rustc_errors::DiagArgValue {
|
||||
format!("{self:?}").into_diag_arg()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ use crate::ty::{
|
|||
};
|
||||
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_errors::{Applicability, Diag, DiagArgValue, IntoDiagnosticArg};
|
||||
use rustc_errors::{Applicability, Diag, DiagArgValue, IntoDiagArg};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::DefId;
|
||||
|
@ -19,9 +19,9 @@ use rustc_hir::{PredicateOrigin, WherePredicate};
|
|||
use rustc_span::{BytePos, Span};
|
||||
use rustc_type_ir::TyKind::*;
|
||||
|
||||
impl<'tcx> IntoDiagnosticArg for Ty<'tcx> {
|
||||
fn into_diagnostic_arg(self) -> DiagArgValue {
|
||||
self.to_string().into_diagnostic_arg()
|
||||
impl<'tcx> IntoDiagArg for Ty<'tcx> {
|
||||
fn into_diag_arg(self) -> DiagArgValue {
|
||||
self.to_string().into_diag_arg()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ use crate::ty::{self, Lift, List, ParamConst, Ty, TyCtxt};
|
|||
use rustc_ast_ir::visit::VisitorResult;
|
||||
use rustc_ast_ir::walk_visitable_list;
|
||||
use rustc_data_structures::intern::Interned;
|
||||
use rustc_errors::{DiagArgValue, IntoDiagnosticArg};
|
||||
use rustc_errors::{DiagArgValue, IntoDiagArg};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_serialize::{Decodable, Encodable};
|
||||
|
@ -57,9 +57,9 @@ unsafe impl<'tcx> Sync for GenericArg<'tcx> where
|
|||
{
|
||||
}
|
||||
|
||||
impl<'tcx> IntoDiagnosticArg for GenericArg<'tcx> {
|
||||
fn into_diagnostic_arg(self) -> DiagArgValue {
|
||||
self.to_string().into_diagnostic_arg()
|
||||
impl<'tcx> IntoDiagArg for GenericArg<'tcx> {
|
||||
fn into_diag_arg(self) -> DiagArgValue {
|
||||
self.to_string().into_diag_arg()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ use crate::ty::normalize_erasing_regions::NormalizationError;
|
|||
use crate::ty::{self, ConstKind, Ty, TyCtxt, TypeVisitableExt};
|
||||
use rustc_error_messages::DiagMessage;
|
||||
use rustc_errors::{
|
||||
Diag, DiagArgValue, DiagCtxt, EmissionGuarantee, IntoDiagnostic, IntoDiagnosticArg, Level,
|
||||
Diag, DiagArgValue, DiagCtxt, EmissionGuarantee, IntoDiagArg, IntoDiagnostic, Level,
|
||||
};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::DefId;
|
||||
|
@ -254,9 +254,9 @@ impl<'tcx> fmt::Display for LayoutError<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx> IntoDiagnosticArg for LayoutError<'tcx> {
|
||||
fn into_diagnostic_arg(self) -> DiagArgValue {
|
||||
self.to_string().into_diagnostic_arg()
|
||||
impl<'tcx> IntoDiagArg for LayoutError<'tcx> {
|
||||
fn into_diag_arg(self) -> DiagArgValue {
|
||||
self.to_string().into_diag_arg()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use rustc_data_structures::captures::Captures;
|
||||
use rustc_data_structures::intern::Interned;
|
||||
use rustc_errors::{DiagArgValue, IntoDiagnosticArg};
|
||||
use rustc_errors::{DiagArgValue, IntoDiagArg};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::LangItem;
|
||||
use rustc_span::Span;
|
||||
|
@ -120,14 +120,14 @@ impl<'tcx> Predicate<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
impl rustc_errors::IntoDiagnosticArg for Predicate<'_> {
|
||||
fn into_diagnostic_arg(self) -> rustc_errors::DiagArgValue {
|
||||
impl rustc_errors::IntoDiagArg for Predicate<'_> {
|
||||
fn into_diag_arg(self) -> rustc_errors::DiagArgValue {
|
||||
rustc_errors::DiagArgValue::Str(std::borrow::Cow::Owned(self.to_string()))
|
||||
}
|
||||
}
|
||||
|
||||
impl rustc_errors::IntoDiagnosticArg for Clause<'_> {
|
||||
fn into_diagnostic_arg(self) -> rustc_errors::DiagArgValue {
|
||||
impl rustc_errors::IntoDiagArg for Clause<'_> {
|
||||
fn into_diag_arg(self) -> rustc_errors::DiagArgValue {
|
||||
rustc_errors::DiagArgValue::Str(std::borrow::Cow::Owned(self.to_string()))
|
||||
}
|
||||
}
|
||||
|
@ -407,9 +407,9 @@ impl<'tcx> PolyTraitRef<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx> IntoDiagnosticArg for TraitRef<'tcx> {
|
||||
fn into_diagnostic_arg(self) -> DiagArgValue {
|
||||
self.to_string().into_diagnostic_arg()
|
||||
impl<'tcx> IntoDiagArg for TraitRef<'tcx> {
|
||||
fn into_diag_arg(self) -> DiagArgValue {
|
||||
self.to_string().into_diag_arg()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -453,9 +453,9 @@ impl<'tcx> ExistentialTraitRef<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx> IntoDiagnosticArg for ExistentialTraitRef<'tcx> {
|
||||
fn into_diagnostic_arg(self) -> DiagArgValue {
|
||||
self.to_string().into_diagnostic_arg()
|
||||
impl<'tcx> IntoDiagArg for ExistentialTraitRef<'tcx> {
|
||||
fn into_diag_arg(self) -> DiagArgValue {
|
||||
self.to_string().into_diag_arg()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2722,9 +2722,9 @@ where
|
|||
#[derive(Copy, Clone, TypeFoldable, TypeVisitable, Lift)]
|
||||
pub struct TraitRefPrintOnlyTraitPath<'tcx>(ty::TraitRef<'tcx>);
|
||||
|
||||
impl<'tcx> rustc_errors::IntoDiagnosticArg for TraitRefPrintOnlyTraitPath<'tcx> {
|
||||
fn into_diagnostic_arg(self) -> rustc_errors::DiagArgValue {
|
||||
self.to_string().into_diagnostic_arg()
|
||||
impl<'tcx> rustc_errors::IntoDiagArg for TraitRefPrintOnlyTraitPath<'tcx> {
|
||||
fn into_diag_arg(self) -> rustc_errors::DiagArgValue {
|
||||
self.to_string().into_diag_arg()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2739,9 +2739,9 @@ impl<'tcx> fmt::Debug for TraitRefPrintOnlyTraitPath<'tcx> {
|
|||
#[derive(Copy, Clone, TypeFoldable, TypeVisitable, Lift)]
|
||||
pub struct TraitRefPrintSugared<'tcx>(ty::TraitRef<'tcx>);
|
||||
|
||||
impl<'tcx> rustc_errors::IntoDiagnosticArg for TraitRefPrintSugared<'tcx> {
|
||||
fn into_diagnostic_arg(self) -> rustc_errors::DiagArgValue {
|
||||
self.to_string().into_diagnostic_arg()
|
||||
impl<'tcx> rustc_errors::IntoDiagArg for TraitRefPrintSugared<'tcx> {
|
||||
fn into_diag_arg(self) -> rustc_errors::DiagArgValue {
|
||||
self.to_string().into_diag_arg()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ use crate::ty::{GenericArg, GenericArgs, GenericArgsRef};
|
|||
use crate::ty::{List, ParamEnv};
|
||||
use hir::def::DefKind;
|
||||
use rustc_data_structures::captures::Captures;
|
||||
use rustc_errors::{DiagArgValue, ErrorGuaranteed, IntoDiagnosticArg, MultiSpan};
|
||||
use rustc_errors::{DiagArgValue, ErrorGuaranteed, IntoDiagArg, MultiSpan};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::LangItem;
|
||||
|
@ -1094,12 +1094,12 @@ impl<'tcx, T: IntoIterator> Binder<'tcx, T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx, T> IntoDiagnosticArg for Binder<'tcx, T>
|
||||
impl<'tcx, T> IntoDiagArg for Binder<'tcx, T>
|
||||
where
|
||||
T: IntoDiagnosticArg,
|
||||
T: IntoDiagArg,
|
||||
{
|
||||
fn into_diagnostic_arg(self) -> DiagArgValue {
|
||||
self.value.into_diagnostic_arg()
|
||||
fn into_diag_arg(self) -> DiagArgValue {
|
||||
self.value.into_diag_arg()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1307,9 +1307,9 @@ impl<'tcx> FnSig<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx> IntoDiagnosticArg for FnSig<'tcx> {
|
||||
fn into_diagnostic_arg(self) -> DiagArgValue {
|
||||
self.to_string().into_diagnostic_arg()
|
||||
impl<'tcx> IntoDiagArg for FnSig<'tcx> {
|
||||
fn into_diag_arg(self) -> DiagArgValue {
|
||||
self.to_string().into_diag_arg()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue