Rename DiagnosticMessage
as DiagMessage
.
This commit is contained in:
parent
d849f5c225
commit
18715c98c6
49 changed files with 253 additions and 261 deletions
|
@ -1,6 +1,6 @@
|
|||
use std::fmt;
|
||||
|
||||
use rustc_errors::{codes::*, DiagArgName, DiagArgValue, DiagnosticMessage};
|
||||
use rustc_errors::{codes::*, DiagArgName, DiagArgValue, DiagMessage};
|
||||
use rustc_macros::Diagnostic;
|
||||
use rustc_span::{Span, Symbol};
|
||||
|
||||
|
@ -93,16 +93,16 @@ pub(super) struct ConstNotUsedTraitAlias {
|
|||
}
|
||||
|
||||
pub struct CustomSubdiagnostic<'a> {
|
||||
pub msg: fn() -> DiagnosticMessage,
|
||||
pub msg: fn() -> DiagMessage,
|
||||
pub add_args: Box<dyn FnOnce(&mut dyn FnMut(DiagArgName, DiagArgValue)) + 'a>,
|
||||
}
|
||||
|
||||
impl<'a> CustomSubdiagnostic<'a> {
|
||||
pub fn label(x: fn() -> DiagnosticMessage) -> Self {
|
||||
pub fn label(x: fn() -> DiagMessage) -> Self {
|
||||
Self::label_and_then(x, |_| {})
|
||||
}
|
||||
pub fn label_and_then<F: FnOnce(&mut dyn FnMut(DiagArgName, DiagArgValue)) + 'a>(
|
||||
msg: fn() -> DiagnosticMessage,
|
||||
msg: fn() -> DiagMessage,
|
||||
f: F,
|
||||
) -> Self {
|
||||
Self { msg, add_args: Box::new(move |x| f(x)) }
|
||||
|
|
|
@ -2,7 +2,7 @@ use std::cmp;
|
|||
|
||||
use rustc_data_structures::fx::FxIndexMap;
|
||||
use rustc_data_structures::sorted_map::SortedMap;
|
||||
use rustc_errors::{Diag, DiagnosticMessage, MultiSpan};
|
||||
use rustc_errors::{Diag, DiagMessage, MultiSpan};
|
||||
use rustc_hir::{HirId, ItemLocalId};
|
||||
use rustc_session::lint::{
|
||||
builtin::{self, FORBIDDEN_LINT_GROUPS},
|
||||
|
@ -268,7 +268,7 @@ pub fn lint_level(
|
|||
level: Level,
|
||||
src: LintLevelSource,
|
||||
span: Option<MultiSpan>,
|
||||
msg: impl Into<DiagnosticMessage>,
|
||||
msg: impl Into<DiagMessage>,
|
||||
decorate: impl for<'a, 'b> FnOnce(&'b mut Diag<'a, ()>),
|
||||
) {
|
||||
// Avoid codegen bloat from monomorphization by immediately doing dyn dispatch of `decorate` to
|
||||
|
@ -280,7 +280,7 @@ pub fn lint_level(
|
|||
level: Level,
|
||||
src: LintLevelSource,
|
||||
span: Option<MultiSpan>,
|
||||
msg: impl Into<DiagnosticMessage>,
|
||||
msg: impl Into<DiagMessage>,
|
||||
decorate: Box<dyn '_ + for<'a, 'b> FnOnce(&'b mut Diag<'a, ()>)>,
|
||||
) {
|
||||
// Check for future incompatibility lints and issue a stronger warning.
|
||||
|
|
|
@ -6,9 +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, DiagnosticMessage, ErrorGuaranteed, IntoDiagnosticArg,
|
||||
};
|
||||
use rustc_errors::{DiagArgName, DiagArgValue, DiagMessage, ErrorGuaranteed, IntoDiagnosticArg};
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_session::CtfeBacktrace;
|
||||
use rustc_span::{def_id::DefId, Span, DUMMY_SP};
|
||||
|
@ -489,7 +487,7 @@ pub enum ResourceExhaustionInfo {
|
|||
/// A trait for machine-specific errors (or other "machine stop" conditions).
|
||||
pub trait MachineStopType: Any + fmt::Debug + Send {
|
||||
/// The diagnostic message for this error
|
||||
fn diagnostic_message(&self) -> DiagnosticMessage;
|
||||
fn diagnostic_message(&self) -> DiagMessage;
|
||||
/// Add diagnostic arguments by passing name and value pairs to `adder`, which are passed to
|
||||
/// fluent for formatting the translated diagnostic message.
|
||||
fn add_args(self: Box<Self>, adder: &mut dyn FnMut(DiagArgName, DiagArgValue));
|
||||
|
|
|
@ -14,9 +14,7 @@ use crate::ty::{AdtDef, InstanceDef, UserTypeAnnotationIndex};
|
|||
use crate::ty::{GenericArg, GenericArgsRef};
|
||||
|
||||
use rustc_data_structures::captures::Captures;
|
||||
use rustc_errors::{
|
||||
DiagArgName, DiagArgValue, DiagnosticMessage, ErrorGuaranteed, IntoDiagnosticArg,
|
||||
};
|
||||
use rustc_errors::{DiagArgName, DiagArgValue, DiagMessage, ErrorGuaranteed, IntoDiagnosticArg};
|
||||
use rustc_hir::def::{CtorKind, Namespace};
|
||||
use rustc_hir::def_id::{DefId, CRATE_DEF_ID};
|
||||
use rustc_hir::{self, CoroutineDesugaring, CoroutineKind, ImplicitSelfKind};
|
||||
|
|
|
@ -251,7 +251,7 @@ impl<O> AssertKind<O> {
|
|||
/// `AssertKind::description` and the lang items mentioned in its docs).
|
||||
/// Note that we deliberately show more details here than we do at runtime, such as the actual
|
||||
/// numbers that overflowed -- it is much easier to do so here than at runtime.
|
||||
pub fn diagnostic_message(&self) -> DiagnosticMessage {
|
||||
pub fn diagnostic_message(&self) -> DiagMessage {
|
||||
use crate::fluent_generated::*;
|
||||
use AssertKind::*;
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ use rustc_data_structures::sync::{self, FreezeReadGuard, Lock, WorkerLocal};
|
|||
#[cfg(parallel_compiler)]
|
||||
use rustc_data_structures::sync::{DynSend, DynSync};
|
||||
use rustc_data_structures::unord::UnordSet;
|
||||
use rustc_errors::{DecorateLint, Diag, DiagCtxt, DiagnosticMessage, ErrorGuaranteed, MultiSpan};
|
||||
use rustc_errors::{DecorateLint, Diag, DiagCtxt, DiagMessage, ErrorGuaranteed, MultiSpan};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LOCAL_CRATE};
|
||||
|
@ -2097,7 +2097,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
lint: &'static Lint,
|
||||
hir_id: HirId,
|
||||
span: impl Into<MultiSpan>,
|
||||
msg: impl Into<DiagnosticMessage>,
|
||||
msg: impl Into<DiagMessage>,
|
||||
decorate: impl for<'a, 'b> FnOnce(&'b mut Diag<'a, ()>),
|
||||
) {
|
||||
let (level, src) = self.lint_level_at_node(lint, hir_id);
|
||||
|
@ -2127,7 +2127,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
self,
|
||||
lint: &'static Lint,
|
||||
id: HirId,
|
||||
msg: impl Into<DiagnosticMessage>,
|
||||
msg: impl Into<DiagMessage>,
|
||||
decorate: impl for<'a, 'b> FnOnce(&'b mut Diag<'a, ()>),
|
||||
) {
|
||||
let (level, src) = self.lint_level_at_node(lint, id);
|
||||
|
|
|
@ -3,7 +3,7 @@ use crate::middle::codegen_fn_attrs::CodegenFnAttrFlags;
|
|||
use crate::query::TyCtxtAt;
|
||||
use crate::ty::normalize_erasing_regions::NormalizationError;
|
||||
use crate::ty::{self, ConstKind, Ty, TyCtxt, TypeVisitableExt};
|
||||
use rustc_error_messages::DiagnosticMessage;
|
||||
use rustc_error_messages::DiagMessage;
|
||||
use rustc_errors::{
|
||||
Diag, DiagArgValue, DiagCtxt, EmissionGuarantee, IntoDiagnostic, IntoDiagnosticArg, Level,
|
||||
};
|
||||
|
@ -205,7 +205,7 @@ pub enum LayoutError<'tcx> {
|
|||
}
|
||||
|
||||
impl<'tcx> LayoutError<'tcx> {
|
||||
pub fn diagnostic_message(&self) -> DiagnosticMessage {
|
||||
pub fn diagnostic_message(&self) -> DiagMessage {
|
||||
use crate::fluent_generated::*;
|
||||
use LayoutError::*;
|
||||
match self {
|
||||
|
|
|
@ -13,9 +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, DiagnosticMessage, ErrorGuaranteed, IntoDiagnosticArg, MultiSpan,
|
||||
};
|
||||
use rustc_errors::{DiagArgValue, DiagMessage, ErrorGuaranteed, IntoDiagnosticArg, MultiSpan};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::LangItem;
|
||||
|
@ -1545,7 +1543,7 @@ impl<'tcx> Ty<'tcx> {
|
|||
pub fn new_error_with_message<S: Into<MultiSpan>>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
span: S,
|
||||
msg: impl Into<DiagnosticMessage>,
|
||||
msg: impl Into<DiagMessage>,
|
||||
) -> Ty<'tcx> {
|
||||
let reported = tcx.dcx().span_delayed_bug(span, msg);
|
||||
Ty::new(tcx, Error(reported))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue