mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 10:13:54 +00:00
Rename DiagnosticLocation
as DiagLocation
.
This commit is contained in:
parent
d0ef108ce9
commit
e3c19a2928
@ -184,21 +184,21 @@ pub trait DecorateLint<'a, G: EmissionGuarantee> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Encodable, Decodable)]
|
#[derive(Clone, Debug, Encodable, Decodable)]
|
||||||
pub struct DiagnosticLocation {
|
pub struct DiagLocation {
|
||||||
file: Cow<'static, str>,
|
file: Cow<'static, str>,
|
||||||
line: u32,
|
line: u32,
|
||||||
col: u32,
|
col: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DiagnosticLocation {
|
impl DiagLocation {
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
fn caller() -> Self {
|
fn caller() -> Self {
|
||||||
let loc = panic::Location::caller();
|
let loc = panic::Location::caller();
|
||||||
DiagnosticLocation { file: loc.file().into(), line: loc.line(), col: loc.column() }
|
DiagLocation { file: loc.file().into(), line: loc.line(), col: loc.column() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for DiagnosticLocation {
|
impl fmt::Display for DiagLocation {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
write!(f, "{}:{}:{}", self.file, self.line, self.col)
|
write!(f, "{}:{}:{}", self.file, self.line, self.col)
|
||||||
}
|
}
|
||||||
@ -288,7 +288,7 @@ pub struct DiagInner {
|
|||||||
|
|
||||||
/// With `-Ztrack_diagnostics` enabled,
|
/// With `-Ztrack_diagnostics` enabled,
|
||||||
/// we print where in rustc this error was emitted.
|
/// we print where in rustc this error was emitted.
|
||||||
pub(crate) emitted_at: DiagnosticLocation,
|
pub(crate) emitted_at: DiagLocation,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DiagInner {
|
impl DiagInner {
|
||||||
@ -309,7 +309,7 @@ impl DiagInner {
|
|||||||
args: Default::default(),
|
args: Default::default(),
|
||||||
sort_span: DUMMY_SP,
|
sort_span: DUMMY_SP,
|
||||||
is_lint: None,
|
is_lint: None,
|
||||||
emitted_at: DiagnosticLocation::caller(),
|
emitted_at: DiagLocation::caller(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use crate::diagnostic::DiagnosticLocation;
|
use crate::diagnostic::DiagLocation;
|
||||||
use crate::{fluent_generated as fluent, AddToDiagnostic};
|
use crate::{fluent_generated as fluent, AddToDiagnostic};
|
||||||
use crate::{
|
use crate::{
|
||||||
Diag, DiagArgValue, DiagCtxt, EmissionGuarantee, ErrCode, IntoDiagnostic, IntoDiagnosticArg,
|
Diag, DiagArgValue, DiagCtxt, EmissionGuarantee, ErrCode, IntoDiagnostic, IntoDiagnosticArg,
|
||||||
@ -315,7 +315,7 @@ pub struct ExpectedLifetimeParameter {
|
|||||||
pub count: usize,
|
pub count: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl IntoDiagnosticArg for DiagnosticLocation {
|
impl IntoDiagnosticArg for DiagLocation {
|
||||||
fn into_diagnostic_arg(self) -> DiagArgValue {
|
fn into_diagnostic_arg(self) -> DiagArgValue {
|
||||||
DiagArgValue::Str(Cow::from(self.to_string()))
|
DiagArgValue::Str(Cow::from(self.to_string()))
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,8 @@ use crate::snippet::{
|
|||||||
use crate::styled_buffer::StyledBuffer;
|
use crate::styled_buffer::StyledBuffer;
|
||||||
use crate::translation::{to_fluent_args, Translate};
|
use crate::translation::{to_fluent_args, Translate};
|
||||||
use crate::{
|
use crate::{
|
||||||
diagnostic::DiagnosticLocation, CodeSuggestion, DiagCtxt, DiagInner, DiagnosticMessage,
|
diagnostic::DiagLocation, CodeSuggestion, DiagCtxt, DiagInner, DiagnosticMessage, ErrCode,
|
||||||
ErrCode, FluentBundle, LazyFallbackBundle, Level, MultiSpan, Subdiag, SubstitutionHighlight,
|
FluentBundle, LazyFallbackBundle, Level, MultiSpan, Subdiag, SubstitutionHighlight,
|
||||||
SuggestionStyle, TerminalUrl,
|
SuggestionStyle, TerminalUrl,
|
||||||
};
|
};
|
||||||
use rustc_lint_defs::pluralize;
|
use rustc_lint_defs::pluralize;
|
||||||
@ -1327,7 +1327,7 @@ impl HumanEmitter {
|
|||||||
level: &Level,
|
level: &Level,
|
||||||
max_line_num_len: usize,
|
max_line_num_len: usize,
|
||||||
is_secondary: bool,
|
is_secondary: bool,
|
||||||
emitted_at: Option<&DiagnosticLocation>,
|
emitted_at: Option<&DiagLocation>,
|
||||||
) -> io::Result<()> {
|
) -> io::Result<()> {
|
||||||
let mut buffer = StyledBuffer::new();
|
let mut buffer = StyledBuffer::new();
|
||||||
|
|
||||||
@ -2096,7 +2096,7 @@ impl HumanEmitter {
|
|||||||
span: &MultiSpan,
|
span: &MultiSpan,
|
||||||
children: &[Subdiag],
|
children: &[Subdiag],
|
||||||
suggestions: &[CodeSuggestion],
|
suggestions: &[CodeSuggestion],
|
||||||
emitted_at: Option<&DiagnosticLocation>,
|
emitted_at: Option<&DiagLocation>,
|
||||||
) {
|
) {
|
||||||
let max_line_num_len = if self.ui_testing {
|
let max_line_num_len = if self.ui_testing {
|
||||||
ANONYMIZED_LINE_NUM.len()
|
ANONYMIZED_LINE_NUM.len()
|
||||||
|
Loading…
Reference in New Issue
Block a user