mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 11:07:42 +00:00
Rename DiagnosticArgFromDisplay
as DiagArgFromDisplay
.
This commit is contained in:
parent
8199632aa8
commit
d0ef108ce9
@ -1,6 +1,5 @@
|
|||||||
use rustc_errors::{
|
use rustc_errors::{
|
||||||
codes::*, AddToDiagnostic, Diag, DiagnosticArgFromDisplay, EmissionGuarantee,
|
codes::*, AddToDiagnostic, Diag, DiagArgFromDisplay, EmissionGuarantee, SubdiagnosticMessageOp,
|
||||||
SubdiagnosticMessageOp,
|
|
||||||
};
|
};
|
||||||
use rustc_macros::{Diagnostic, Subdiagnostic};
|
use rustc_macros::{Diagnostic, Subdiagnostic};
|
||||||
use rustc_span::{symbol::Ident, Span, Symbol};
|
use rustc_span::{symbol::Ident, Span, Symbol};
|
||||||
@ -95,7 +94,7 @@ pub enum AssocTyParenthesesSub {
|
|||||||
pub struct MisplacedImplTrait<'a> {
|
pub struct MisplacedImplTrait<'a> {
|
||||||
#[primary_span]
|
#[primary_span]
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
pub position: DiagnosticArgFromDisplay<'a>,
|
pub position: DiagArgFromDisplay<'a>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
|
@ -51,7 +51,7 @@ use rustc_data_structures::fingerprint::Fingerprint;
|
|||||||
use rustc_data_structures::sorted_map::SortedMap;
|
use rustc_data_structures::sorted_map::SortedMap;
|
||||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||||
use rustc_data_structures::sync::Lrc;
|
use rustc_data_structures::sync::Lrc;
|
||||||
use rustc_errors::{DiagCtxt, DiagnosticArgFromDisplay, StashKey};
|
use rustc_errors::{DiagArgFromDisplay, DiagCtxt, StashKey};
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
use rustc_hir::def::{DefKind, LifetimeRes, Namespace, PartialRes, PerNS, Res};
|
use rustc_hir::def::{DefKind, LifetimeRes, Namespace, PartialRes, PerNS, Res};
|
||||||
use rustc_hir::def_id::{LocalDefId, LocalDefIdMap, CRATE_DEF_ID, LOCAL_CRATE};
|
use rustc_hir::def_id::{LocalDefId, LocalDefIdMap, CRATE_DEF_ID, LOCAL_CRATE};
|
||||||
@ -1473,7 +1473,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||||||
.create_feature_err(
|
.create_feature_err(
|
||||||
MisplacedImplTrait {
|
MisplacedImplTrait {
|
||||||
span: t.span,
|
span: t.span,
|
||||||
position: DiagnosticArgFromDisplay(&position),
|
position: DiagArgFromDisplay(&position),
|
||||||
},
|
},
|
||||||
feature,
|
feature,
|
||||||
)
|
)
|
||||||
@ -1483,7 +1483,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||||||
ImplTraitContext::Disallowed(position) => {
|
ImplTraitContext::Disallowed(position) => {
|
||||||
let guar = self.dcx().emit_err(MisplacedImplTrait {
|
let guar = self.dcx().emit_err(MisplacedImplTrait {
|
||||||
span: t.span,
|
span: t.span,
|
||||||
position: DiagnosticArgFromDisplay(&position),
|
position: DiagArgFromDisplay(&position),
|
||||||
});
|
});
|
||||||
hir::TyKind::Err(guar)
|
hir::TyKind::Err(guar)
|
||||||
}
|
}
|
||||||
|
@ -20,23 +20,23 @@ use std::num::ParseIntError;
|
|||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::ExitStatus;
|
use std::process::ExitStatus;
|
||||||
|
|
||||||
pub struct DiagnosticArgFromDisplay<'a>(pub &'a dyn fmt::Display);
|
pub struct DiagArgFromDisplay<'a>(pub &'a dyn fmt::Display);
|
||||||
|
|
||||||
impl IntoDiagnosticArg for DiagnosticArgFromDisplay<'_> {
|
impl IntoDiagnosticArg for DiagArgFromDisplay<'_> {
|
||||||
fn into_diagnostic_arg(self) -> DiagArgValue {
|
fn into_diagnostic_arg(self) -> DiagArgValue {
|
||||||
self.0.to_string().into_diagnostic_arg()
|
self.0.to_string().into_diagnostic_arg()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> From<&'a dyn fmt::Display> for DiagnosticArgFromDisplay<'a> {
|
impl<'a> From<&'a dyn fmt::Display> for DiagArgFromDisplay<'a> {
|
||||||
fn from(t: &'a dyn fmt::Display) -> Self {
|
fn from(t: &'a dyn fmt::Display) -> Self {
|
||||||
DiagnosticArgFromDisplay(t)
|
DiagArgFromDisplay(t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: fmt::Display> From<&'a T> for DiagnosticArgFromDisplay<'a> {
|
impl<'a, T: fmt::Display> From<&'a T> for DiagArgFromDisplay<'a> {
|
||||||
fn from(t: &'a T) -> Self {
|
fn from(t: &'a T) -> Self {
|
||||||
DiagnosticArgFromDisplay(t)
|
DiagArgFromDisplay(t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,8 +42,8 @@ pub use diagnostic::{
|
|||||||
IntoDiagnosticArg, StringPart, Subdiag, SubdiagnosticMessageOp,
|
IntoDiagnosticArg, StringPart, Subdiag, SubdiagnosticMessageOp,
|
||||||
};
|
};
|
||||||
pub use diagnostic_impls::{
|
pub use diagnostic_impls::{
|
||||||
DiagnosticArgFromDisplay, DiagnosticSymbolList, ExpectedLifetimeParameter,
|
DiagArgFromDisplay, DiagnosticSymbolList, ExpectedLifetimeParameter, IndicateAnonymousLifetime,
|
||||||
IndicateAnonymousLifetime, SingleLabelManySpans,
|
SingleLabelManySpans,
|
||||||
};
|
};
|
||||||
pub use emitter::ColorConfig;
|
pub use emitter::ColorConfig;
|
||||||
pub use rustc_error_messages::{
|
pub use rustc_error_messages::{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use rustc_errors::{codes::*, DiagnosticArgFromDisplay};
|
use rustc_errors::{codes::*, DiagArgFromDisplay};
|
||||||
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
|
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
|
||||||
use rustc_span::{Span, Symbol};
|
use rustc_span::{Span, Symbol};
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ pub struct ItemIsPrivate<'a> {
|
|||||||
#[label]
|
#[label]
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
pub kind: &'a str,
|
pub kind: &'a str,
|
||||||
pub descr: DiagnosticArgFromDisplay<'a>,
|
pub descr: DiagArgFromDisplay<'a>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
@ -55,7 +55,7 @@ pub struct InPublicInterface<'a> {
|
|||||||
pub span: Span,
|
pub span: Span,
|
||||||
pub vis_descr: &'static str,
|
pub vis_descr: &'static str,
|
||||||
pub kind: &'a str,
|
pub kind: &'a str,
|
||||||
pub descr: DiagnosticArgFromDisplay<'a>,
|
pub descr: DiagArgFromDisplay<'a>,
|
||||||
#[label(privacy_visibility_label)]
|
#[label(privacy_visibility_label)]
|
||||||
pub vis_span: Span,
|
pub vis_span: Span,
|
||||||
}
|
}
|
||||||
@ -72,7 +72,7 @@ pub struct ReportEffectiveVisibility {
|
|||||||
#[diag(privacy_from_private_dep_in_public_interface)]
|
#[diag(privacy_from_private_dep_in_public_interface)]
|
||||||
pub struct FromPrivateDependencyInPublicInterface<'a> {
|
pub struct FromPrivateDependencyInPublicInterface<'a> {
|
||||||
pub kind: &'a str,
|
pub kind: &'a str,
|
||||||
pub descr: DiagnosticArgFromDisplay<'a>,
|
pub descr: DiagArgFromDisplay<'a>,
|
||||||
pub krate: Symbol,
|
pub krate: Symbol,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ pub struct UnnameableTypesLint<'a> {
|
|||||||
#[label]
|
#[label]
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
pub kind: &'a str,
|
pub kind: &'a str,
|
||||||
pub descr: DiagnosticArgFromDisplay<'a>,
|
pub descr: DiagArgFromDisplay<'a>,
|
||||||
pub reachable_vis: &'a str,
|
pub reachable_vis: &'a str,
|
||||||
pub reexported_vis: &'a str,
|
pub reexported_vis: &'a str,
|
||||||
}
|
}
|
||||||
@ -96,11 +96,11 @@ pub struct PrivateInterfacesOrBoundsLint<'a> {
|
|||||||
#[label(privacy_item_label)]
|
#[label(privacy_item_label)]
|
||||||
pub item_span: Span,
|
pub item_span: Span,
|
||||||
pub item_kind: &'a str,
|
pub item_kind: &'a str,
|
||||||
pub item_descr: DiagnosticArgFromDisplay<'a>,
|
pub item_descr: DiagArgFromDisplay<'a>,
|
||||||
pub item_vis_descr: &'a str,
|
pub item_vis_descr: &'a str,
|
||||||
#[note(privacy_ty_note)]
|
#[note(privacy_ty_note)]
|
||||||
pub ty_span: Span,
|
pub ty_span: Span,
|
||||||
pub ty_kind: &'a str,
|
pub ty_kind: &'a str,
|
||||||
pub ty_descr: DiagnosticArgFromDisplay<'a>,
|
pub ty_descr: DiagArgFromDisplay<'a>,
|
||||||
pub ty_vis_descr: &'a str,
|
pub ty_vis_descr: &'a str,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user