Rename Diagnostic
as DiagInner
.
I started by changing it to `DiagData`, but that didn't feel right. `DiagInner` felt much better.
This commit is contained in:
parent
1e4f9e302c
commit
6588f5b749
14 changed files with 87 additions and 87 deletions
|
@ -9,7 +9,7 @@ use crate::emitter::FileWithAnnotatedLines;
|
|||
use crate::snippet::Line;
|
||||
use crate::translation::{to_fluent_args, Translate};
|
||||
use crate::{
|
||||
CodeSuggestion, Diagnostic, DiagnosticMessage, Emitter, ErrCode, FluentBundle,
|
||||
CodeSuggestion, DiagInner, DiagnosticMessage, Emitter, ErrCode, FluentBundle,
|
||||
LazyFallbackBundle, Level, MultiSpan, Style, SubDiagnostic,
|
||||
};
|
||||
use annotate_snippets::{Annotation, AnnotationType, Renderer, Slice, Snippet, SourceAnnotation};
|
||||
|
@ -44,7 +44,7 @@ impl Translate for AnnotateSnippetEmitter {
|
|||
|
||||
impl Emitter for AnnotateSnippetEmitter {
|
||||
/// The entry point for the diagnostics generation
|
||||
fn emit_diagnostic(&mut self, mut diag: Diagnostic) {
|
||||
fn emit_diagnostic(&mut self, mut diag: DiagInner) {
|
||||
let fluent_args = to_fluent_args(diag.args.iter());
|
||||
|
||||
let mut suggestions = diag.suggestions.unwrap_or(vec![]);
|
||||
|
@ -82,7 +82,7 @@ fn source_string(file: Lrc<SourceFile>, line: &Line) -> String {
|
|||
file.get_line(line.line_index - 1).map(|a| a.to_string()).unwrap_or_default()
|
||||
}
|
||||
|
||||
/// Maps `Diagnostic::Level` to `snippet::AnnotationType`
|
||||
/// Maps `diagnostic::Level` to `snippet::AnnotationType`
|
||||
fn annotation_type_for_level(level: Level) -> AnnotationType {
|
||||
match level {
|
||||
Level::Bug | Level::Fatal | Level::Error | Level::DelayedBug => AnnotationType::Error,
|
||||
|
|
|
@ -18,8 +18,8 @@ use std::ops::{Deref, DerefMut};
|
|||
use std::panic;
|
||||
use std::thread::panicking;
|
||||
|
||||
/// Error type for `Diagnostic`'s `suggestions` field, indicating that
|
||||
/// `.disable_suggestions()` was called on the `Diagnostic`.
|
||||
/// Error type for `DiagInner`'s `suggestions` field, indicating that
|
||||
/// `.disable_suggestions()` was called on the `DiagInner`.
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, Encodable, Decodable)]
|
||||
pub struct SuggestionsDisabled;
|
||||
|
||||
|
@ -267,7 +267,7 @@ impl StringPart {
|
|||
/// causes difficulties, e.g. when storing diagnostics within `DiagCtxt`.
|
||||
#[must_use]
|
||||
#[derive(Clone, Debug, Encodable, Decodable)]
|
||||
pub struct Diagnostic {
|
||||
pub struct DiagInner {
|
||||
// NOTE(eddyb) this is private to disallow arbitrary after-the-fact changes,
|
||||
// outside of what methods in this crate themselves allow.
|
||||
pub(crate) level: Level,
|
||||
|
@ -291,15 +291,15 @@ pub struct Diagnostic {
|
|||
pub(crate) emitted_at: DiagnosticLocation,
|
||||
}
|
||||
|
||||
impl Diagnostic {
|
||||
impl DiagInner {
|
||||
#[track_caller]
|
||||
pub fn new<M: Into<DiagnosticMessage>>(level: Level, message: M) -> Self {
|
||||
Diagnostic::new_with_messages(level, vec![(message.into(), Style::NoStyle)])
|
||||
DiagInner::new_with_messages(level, vec![(message.into(), Style::NoStyle)])
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
pub fn new_with_messages(level: Level, messages: Vec<(DiagnosticMessage, Style)>) -> Self {
|
||||
Diagnostic {
|
||||
DiagInner {
|
||||
level,
|
||||
messages,
|
||||
code: None,
|
||||
|
@ -433,7 +433,7 @@ impl Diagnostic {
|
|||
}
|
||||
}
|
||||
|
||||
impl Hash for Diagnostic {
|
||||
impl Hash for DiagInner {
|
||||
fn hash<H>(&self, state: &mut H)
|
||||
where
|
||||
H: Hasher,
|
||||
|
@ -442,7 +442,7 @@ impl Hash for Diagnostic {
|
|||
}
|
||||
}
|
||||
|
||||
impl PartialEq for Diagnostic {
|
||||
impl PartialEq for DiagInner {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.keys() == other.keys()
|
||||
}
|
||||
|
@ -458,7 +458,7 @@ pub struct SubDiagnostic {
|
|||
}
|
||||
|
||||
/// Used for emitting structured error messages and other diagnostic information.
|
||||
/// Wraps a `Diagnostic`, adding some useful things.
|
||||
/// Wraps a `DiagInner`, adding some useful things.
|
||||
/// - The `dcx` field, allowing it to (a) emit itself, and (b) do a drop check
|
||||
/// that it has been emitted or cancelled.
|
||||
/// - The `EmissionGuarantee`, which determines the type returned from `emit`.
|
||||
|
@ -480,11 +480,11 @@ pub struct DiagnosticBuilder<'a, G: EmissionGuarantee = ErrorGuaranteed> {
|
|||
/// replaced with `None`. Then `drop` checks that it is `None`; if not, it
|
||||
/// panics because a diagnostic was built but not used.
|
||||
///
|
||||
/// Why the Box? `Diagnostic` is a large type, and `DiagnosticBuilder` is
|
||||
/// Why the Box? `DiagInner` is a large type, and `DiagnosticBuilder` is
|
||||
/// often used as a return value, especially within the frequently-used
|
||||
/// `PResult` type. In theory, return value optimization (RVO) should avoid
|
||||
/// unnecessary copying. In practice, it does not (at the time of writing).
|
||||
diag: Option<Box<Diagnostic>>,
|
||||
diag: Option<Box<DiagInner>>,
|
||||
|
||||
_marker: PhantomData<G>,
|
||||
}
|
||||
|
@ -499,15 +499,15 @@ rustc_data_structures::static_assert_size!(
|
|||
);
|
||||
|
||||
impl<G: EmissionGuarantee> Deref for DiagnosticBuilder<'_, G> {
|
||||
type Target = Diagnostic;
|
||||
type Target = DiagInner;
|
||||
|
||||
fn deref(&self) -> &Diagnostic {
|
||||
fn deref(&self) -> &DiagInner {
|
||||
self.diag.as_ref().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
impl<G: EmissionGuarantee> DerefMut for DiagnosticBuilder<'_, G> {
|
||||
fn deref_mut(&mut self) -> &mut Diagnostic {
|
||||
fn deref_mut(&mut self) -> &mut DiagInner {
|
||||
self.diag.as_mut().unwrap()
|
||||
}
|
||||
}
|
||||
|
@ -565,13 +565,13 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
|
|||
#[rustc_lint_diagnostics]
|
||||
#[track_caller]
|
||||
pub fn new<M: Into<DiagnosticMessage>>(dcx: &'a DiagCtxt, level: Level, message: M) -> Self {
|
||||
Self::new_diagnostic(dcx, Diagnostic::new(level, message))
|
||||
Self::new_diagnostic(dcx, DiagInner::new(level, message))
|
||||
}
|
||||
|
||||
/// Creates a new `DiagnosticBuilder` with an already constructed
|
||||
/// diagnostic.
|
||||
#[track_caller]
|
||||
pub(crate) fn new_diagnostic(dcx: &'a DiagCtxt, diag: Diagnostic) -> Self {
|
||||
pub(crate) fn new_diagnostic(dcx: &'a DiagCtxt, diag: DiagInner) -> Self {
|
||||
debug!("Created new diagnostic");
|
||||
Self { dcx, diag: Some(Box::new(diag)), _marker: PhantomData }
|
||||
}
|
||||
|
@ -1238,7 +1238,7 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
|
|||
/// Takes the diagnostic. For use by methods that consume the
|
||||
/// DiagnosticBuilder: `emit`, `cancel`, etc. Afterwards, `drop` is the
|
||||
/// only code that will be run on `self`.
|
||||
fn take_diag(&mut self) -> Diagnostic {
|
||||
fn take_diag(&mut self) -> DiagInner {
|
||||
Box::into_inner(self.diag.take().unwrap())
|
||||
}
|
||||
|
||||
|
@ -1257,7 +1257,7 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
|
|||
// because delayed bugs have their level changed to `Bug` when they are
|
||||
// actually printed, so they produce an ICE.
|
||||
//
|
||||
// (Also, even though `level` isn't `pub`, the whole `Diagnostic` could
|
||||
// (Also, even though `level` isn't `pub`, the whole `DiagInner` could
|
||||
// be overwritten with a new one thanks to `DerefMut`. So this assert
|
||||
// protects against that, too.)
|
||||
assert!(
|
||||
|
@ -1325,7 +1325,7 @@ impl<G: EmissionGuarantee> Drop for DiagnosticBuilder<'_, G> {
|
|||
fn drop(&mut self) {
|
||||
match self.diag.take() {
|
||||
Some(diag) if !panicking() => {
|
||||
self.dcx.emit_diagnostic(Diagnostic::new(
|
||||
self.dcx.emit_diagnostic(DiagInner::new(
|
||||
Level::Bug,
|
||||
DiagnosticMessage::from("the following error was constructed but not emitted"),
|
||||
));
|
||||
|
|
|
@ -17,7 +17,7 @@ use crate::snippet::{
|
|||
use crate::styled_buffer::StyledBuffer;
|
||||
use crate::translation::{to_fluent_args, Translate};
|
||||
use crate::{
|
||||
diagnostic::DiagnosticLocation, CodeSuggestion, DiagCtxt, Diagnostic, DiagnosticMessage,
|
||||
diagnostic::DiagnosticLocation, CodeSuggestion, DiagCtxt, DiagInner, DiagnosticMessage,
|
||||
ErrCode, FluentBundle, LazyFallbackBundle, Level, MultiSpan, SubDiagnostic,
|
||||
SubstitutionHighlight, SuggestionStyle, TerminalUrl,
|
||||
};
|
||||
|
@ -194,7 +194,7 @@ pub type DynEmitter = dyn Emitter + DynSend;
|
|||
/// Emitter trait for emitting errors.
|
||||
pub trait Emitter: Translate {
|
||||
/// Emit a structured diagnostic.
|
||||
fn emit_diagnostic(&mut self, diag: Diagnostic);
|
||||
fn emit_diagnostic(&mut self, diag: DiagInner);
|
||||
|
||||
/// Emit a notification that an artifact has been output.
|
||||
/// Currently only supported for the JSON format.
|
||||
|
@ -202,7 +202,7 @@ pub trait Emitter: Translate {
|
|||
|
||||
/// Emit a report about future breakage.
|
||||
/// Currently only supported for the JSON format.
|
||||
fn emit_future_breakage_report(&mut self, _diags: Vec<Diagnostic>) {}
|
||||
fn emit_future_breakage_report(&mut self, _diags: Vec<DiagInner>) {}
|
||||
|
||||
/// Emit list of unused externs.
|
||||
/// Currently only supported for the JSON format.
|
||||
|
@ -229,12 +229,12 @@ pub trait Emitter: Translate {
|
|||
///
|
||||
/// There are a lot of conditions to this method, but in short:
|
||||
///
|
||||
/// * If the current `Diagnostic` has only one visible `CodeSuggestion`,
|
||||
/// * If the current `DiagInner` has only one visible `CodeSuggestion`,
|
||||
/// we format the `help` suggestion depending on the content of the
|
||||
/// substitutions. In that case, we modify the span and clear the
|
||||
/// suggestions.
|
||||
///
|
||||
/// * If the current `Diagnostic` has multiple suggestions,
|
||||
/// * If the current `DiagInner` has multiple suggestions,
|
||||
/// we leave `primary_span` and the suggestions untouched.
|
||||
fn primary_span_formatted(
|
||||
&mut self,
|
||||
|
@ -518,7 +518,7 @@ impl Emitter for HumanEmitter {
|
|||
self.sm.as_ref()
|
||||
}
|
||||
|
||||
fn emit_diagnostic(&mut self, mut diag: Diagnostic) {
|
||||
fn emit_diagnostic(&mut self, mut diag: DiagInner) {
|
||||
let fluent_args = to_fluent_args(diag.args.iter());
|
||||
|
||||
let mut suggestions = diag.suggestions.unwrap_or(vec![]);
|
||||
|
@ -597,7 +597,7 @@ impl Emitter for SilentEmitter {
|
|||
None
|
||||
}
|
||||
|
||||
fn emit_diagnostic(&mut self, mut diag: Diagnostic) {
|
||||
fn emit_diagnostic(&mut self, mut diag: DiagInner) {
|
||||
if diag.level == Level::Fatal {
|
||||
diag.sub(Level::Note, self.fatal_note.clone(), MultiSpan::new());
|
||||
self.fatal_dcx.emit_diagnostic(diag);
|
||||
|
|
|
@ -176,7 +176,7 @@ impl Translate for JsonEmitter {
|
|||
}
|
||||
|
||||
impl Emitter for JsonEmitter {
|
||||
fn emit_diagnostic(&mut self, diag: crate::Diagnostic) {
|
||||
fn emit_diagnostic(&mut self, diag: crate::DiagInner) {
|
||||
let data = Diagnostic::from_errors_diagnostic(diag, self);
|
||||
let result = self.emit(EmitTyped::Diagnostic(data));
|
||||
if let Err(e) = result {
|
||||
|
@ -192,7 +192,7 @@ impl Emitter for JsonEmitter {
|
|||
}
|
||||
}
|
||||
|
||||
fn emit_future_breakage_report(&mut self, diags: Vec<crate::Diagnostic>) {
|
||||
fn emit_future_breakage_report(&mut self, diags: Vec<crate::DiagInner>) {
|
||||
let data: Vec<FutureBreakageItem<'_>> = diags
|
||||
.into_iter()
|
||||
.map(|mut diag| {
|
||||
|
@ -340,7 +340,7 @@ struct UnusedExterns<'a, 'b, 'c> {
|
|||
}
|
||||
|
||||
impl Diagnostic {
|
||||
fn from_errors_diagnostic(diag: crate::Diagnostic, je: &JsonEmitter) -> Diagnostic {
|
||||
fn from_errors_diagnostic(diag: crate::DiagInner, je: &JsonEmitter) -> Diagnostic {
|
||||
let args = to_fluent_args(diag.args.iter());
|
||||
let sugg = diag.suggestions.iter().flatten().map(|sugg| {
|
||||
let translated_message =
|
||||
|
|
|
@ -37,7 +37,7 @@ extern crate self as rustc_errors;
|
|||
|
||||
pub use codes::*;
|
||||
pub use diagnostic::{
|
||||
AddToDiagnostic, BugAbort, DecorateLint, Diagnostic, DiagnosticArg, DiagnosticArgMap,
|
||||
AddToDiagnostic, BugAbort, DecorateLint, DiagInner, DiagnosticArg, DiagnosticArgMap,
|
||||
DiagnosticArgName, DiagnosticArgValue, DiagnosticBuilder, DiagnosticStyledString,
|
||||
EmissionGuarantee, FatalAbort, IntoDiagnostic, IntoDiagnosticArg, StringPart, SubDiagnostic,
|
||||
SubdiagnosticMessageOp,
|
||||
|
@ -476,9 +476,9 @@ struct DiagCtxtInner {
|
|||
/// add more information). All stashed diagnostics must be emitted with
|
||||
/// `emit_stashed_diagnostics` by the time the `DiagCtxtInner` is dropped,
|
||||
/// otherwise an assertion failure will occur.
|
||||
stashed_diagnostics: FxIndexMap<(Span, StashKey), Diagnostic>,
|
||||
stashed_diagnostics: FxIndexMap<(Span, StashKey), DiagInner>,
|
||||
|
||||
future_breakage_diagnostics: Vec<Diagnostic>,
|
||||
future_breakage_diagnostics: Vec<DiagInner>,
|
||||
|
||||
/// The [`Self::unstable_expect_diagnostics`] should be empty when this struct is
|
||||
/// dropped. However, it can have values if the compilation is stopped early
|
||||
|
@ -487,13 +487,13 @@ struct DiagCtxtInner {
|
|||
/// have been converted.
|
||||
check_unstable_expect_diagnostics: bool,
|
||||
|
||||
/// Expected [`Diagnostic`][struct@diagnostic::Diagnostic]s store a [`LintExpectationId`] as part of
|
||||
/// Expected [`DiagInner`][struct@diagnostic::DiagInner]s store a [`LintExpectationId`] as part of
|
||||
/// the lint level. [`LintExpectationId`]s created early during the compilation
|
||||
/// (before `HirId`s have been defined) are not stable and can therefore not be
|
||||
/// stored on disk. This buffer stores these diagnostics until the ID has been
|
||||
/// replaced by a stable [`LintExpectationId`]. The [`Diagnostic`][struct@diagnostic::Diagnostic]s are the
|
||||
/// submitted for storage and added to the list of fulfilled expectations.
|
||||
unstable_expect_diagnostics: Vec<Diagnostic>,
|
||||
/// replaced by a stable [`LintExpectationId`]. The [`DiagInner`][struct@diagnostic::DiagInner]s
|
||||
/// are submitted for storage and added to the list of fulfilled expectations.
|
||||
unstable_expect_diagnostics: Vec<DiagInner>,
|
||||
|
||||
/// expected diagnostic will have the level `Expect` which additionally
|
||||
/// carries the [`LintExpectationId`] of the expectation that can be
|
||||
|
@ -531,11 +531,11 @@ pub enum StashKey {
|
|||
UndeterminedMacroResolution,
|
||||
}
|
||||
|
||||
fn default_track_diagnostic(diag: Diagnostic, f: &mut dyn FnMut(Diagnostic)) {
|
||||
fn default_track_diagnostic(diag: DiagInner, f: &mut dyn FnMut(DiagInner)) {
|
||||
(*f)(diag)
|
||||
}
|
||||
|
||||
pub static TRACK_DIAGNOSTIC: AtomicRef<fn(Diagnostic, &mut dyn FnMut(Diagnostic))> =
|
||||
pub static TRACK_DIAGNOSTIC: AtomicRef<fn(DiagInner, &mut dyn FnMut(DiagInner))> =
|
||||
AtomicRef::new(&(default_track_diagnostic as _));
|
||||
|
||||
#[derive(Copy, Clone, Default)]
|
||||
|
@ -718,7 +718,7 @@ impl DiagCtxt {
|
|||
|
||||
/// Stash a given diagnostic with the given `Span` and [`StashKey`] as the key.
|
||||
/// Retrieve a stashed diagnostic with `steal_diagnostic`.
|
||||
pub fn stash_diagnostic(&self, span: Span, key: StashKey, diag: Diagnostic) {
|
||||
pub fn stash_diagnostic(&self, span: Span, key: StashKey, diag: DiagInner) {
|
||||
let mut inner = self.inner.borrow_mut();
|
||||
|
||||
let key = (span.with_parent(None), key);
|
||||
|
@ -824,16 +824,16 @@ impl DiagCtxt {
|
|||
(0, _) => {
|
||||
// Use `ForceWarning` rather than `Warning` to guarantee emission, e.g. with a
|
||||
// configuration like `--cap-lints allow --force-warn bare_trait_objects`.
|
||||
inner.emit_diagnostic(Diagnostic::new(
|
||||
inner.emit_diagnostic(DiagInner::new(
|
||||
ForceWarning(None),
|
||||
DiagnosticMessage::Str(warnings),
|
||||
));
|
||||
}
|
||||
(_, 0) => {
|
||||
inner.emit_diagnostic(Diagnostic::new(Error, errors));
|
||||
inner.emit_diagnostic(DiagInner::new(Error, errors));
|
||||
}
|
||||
(_, _) => {
|
||||
inner.emit_diagnostic(Diagnostic::new(Error, format!("{errors}; {warnings}")));
|
||||
inner.emit_diagnostic(DiagInner::new(Error, format!("{errors}; {warnings}")));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -864,14 +864,14 @@ impl DiagCtxt {
|
|||
"For more information about an error, try `rustc --explain {}`.",
|
||||
&error_codes[0]
|
||||
);
|
||||
inner.emit_diagnostic(Diagnostic::new(FailureNote, msg1));
|
||||
inner.emit_diagnostic(Diagnostic::new(FailureNote, msg2));
|
||||
inner.emit_diagnostic(DiagInner::new(FailureNote, msg1));
|
||||
inner.emit_diagnostic(DiagInner::new(FailureNote, msg2));
|
||||
} else {
|
||||
let msg = format!(
|
||||
"For more information about this error, try `rustc --explain {}`.",
|
||||
&error_codes[0]
|
||||
);
|
||||
inner.emit_diagnostic(Diagnostic::new(FailureNote, msg));
|
||||
inner.emit_diagnostic(DiagInner::new(FailureNote, msg));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -896,7 +896,7 @@ impl DiagCtxt {
|
|||
self.inner.borrow_mut().taught_diagnostics.insert(code)
|
||||
}
|
||||
|
||||
pub fn emit_diagnostic(&self, diagnostic: Diagnostic) -> Option<ErrorGuaranteed> {
|
||||
pub fn emit_diagnostic(&self, diagnostic: DiagInner) -> Option<ErrorGuaranteed> {
|
||||
self.inner.borrow_mut().emit_diagnostic(diagnostic)
|
||||
}
|
||||
|
||||
|
@ -1305,7 +1305,7 @@ impl DiagCtxtInner {
|
|||
}
|
||||
|
||||
// Return value is only `Some` if the level is `Error` or `DelayedBug`.
|
||||
fn emit_diagnostic(&mut self, mut diagnostic: Diagnostic) -> Option<ErrorGuaranteed> {
|
||||
fn emit_diagnostic(&mut self, mut diagnostic: DiagInner) -> Option<ErrorGuaranteed> {
|
||||
assert!(diagnostic.level.can_be_top_or_sub().0);
|
||||
|
||||
if let Some(expectation_id) = diagnostic.level.get_expectation_id() {
|
||||
|
@ -1494,7 +1494,7 @@ impl DiagCtxtInner {
|
|||
|
||||
fn eagerly_translate_for_subdiag(
|
||||
&self,
|
||||
diag: &Diagnostic,
|
||||
diag: &DiagInner,
|
||||
msg: impl Into<SubdiagnosticMessage>,
|
||||
) -> SubdiagnosticMessage {
|
||||
let msg = diag.subdiagnostic_message_to_diagnostic_message(msg);
|
||||
|
@ -1539,8 +1539,8 @@ impl DiagCtxtInner {
|
|||
// could trigger `-Ztreat-err-as-bug`, which we don't want.
|
||||
let note1 = "no errors encountered even though delayed bugs were created";
|
||||
let note2 = "those delayed bugs will now be shown as internal compiler errors";
|
||||
self.emit_diagnostic(Diagnostic::new(Note, note1));
|
||||
self.emit_diagnostic(Diagnostic::new(Note, note2));
|
||||
self.emit_diagnostic(DiagInner::new(Note, note1));
|
||||
self.emit_diagnostic(DiagInner::new(Note, note2));
|
||||
}
|
||||
|
||||
let mut bug =
|
||||
|
@ -1551,7 +1551,7 @@ impl DiagCtxtInner {
|
|||
// NOTE(eddyb) not panicking here because we're already producing
|
||||
// an ICE, and the more information the merrier.
|
||||
//
|
||||
// We are at the `Diagnostic`/`DiagCtxtInner` level rather than
|
||||
// We are at the `DiagInner`/`DiagCtxtInner` level rather than
|
||||
// the usual `DiagnosticBuilder`/`DiagCtxt` level, so we must
|
||||
// augment `bug` in a lower-level fashion.
|
||||
bug.arg("level", bug.level);
|
||||
|
@ -1582,17 +1582,17 @@ impl DiagCtxtInner {
|
|||
}
|
||||
|
||||
struct DelayedDiagnostic {
|
||||
inner: Diagnostic,
|
||||
inner: DiagInner,
|
||||
note: Backtrace,
|
||||
}
|
||||
|
||||
impl DelayedDiagnostic {
|
||||
fn with_backtrace(diagnostic: Diagnostic, backtrace: Backtrace) -> Self {
|
||||
fn with_backtrace(diagnostic: DiagInner, backtrace: Backtrace) -> Self {
|
||||
DelayedDiagnostic { inner: diagnostic, note: backtrace }
|
||||
}
|
||||
|
||||
fn decorate(self, dcx: &DiagCtxtInner) -> Diagnostic {
|
||||
// We are at the `Diagnostic`/`DiagCtxtInner` level rather than the
|
||||
fn decorate(self, dcx: &DiagCtxtInner) -> DiagInner {
|
||||
// We are at the `DiagInner`/`DiagCtxtInner` level rather than the
|
||||
// usual `DiagnosticBuilder`/`DiagCtxt` level, so we must construct
|
||||
// `diag` in a lower-level fashion.
|
||||
let mut diag = self.inner;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue