Rollup merge of #101075 - ellishg:rustc_codegen_gcc_diagnostics, r=davidtwco
Migrate rustc_codegen_gcc to SessionDiagnostics As part of #100717 this pr migrates diagnostics to `SessionDiagnostics` for the `rustc_codegen_gcc` crate. ``@rustbot`` label +A-translation
This commit is contained in:
commit
25017f8bce
12 changed files with 417 additions and 163 deletions
|
@ -5,6 +5,7 @@ use crate::{
|
|||
};
|
||||
use crate::{Handler, Level, MultiSpan, StashKey};
|
||||
use rustc_lint_defs::Applicability;
|
||||
use rustc_span::source_map::Spanned;
|
||||
|
||||
use rustc_span::Span;
|
||||
use std::borrow::Cow;
|
||||
|
@ -23,6 +24,18 @@ pub trait IntoDiagnostic<'a, T: EmissionGuarantee = ErrorGuaranteed> {
|
|||
fn into_diagnostic(self, handler: &'a Handler) -> DiagnosticBuilder<'a, T>;
|
||||
}
|
||||
|
||||
impl<'a, T, E> IntoDiagnostic<'a, E> for Spanned<T>
|
||||
where
|
||||
T: IntoDiagnostic<'a, E>,
|
||||
E: EmissionGuarantee,
|
||||
{
|
||||
fn into_diagnostic(self, handler: &'a Handler) -> DiagnosticBuilder<'a, E> {
|
||||
let mut diag = self.node.into_diagnostic(handler);
|
||||
diag.set_span(self.span);
|
||||
diag
|
||||
}
|
||||
}
|
||||
|
||||
/// Used for emitting structured error messages and other diagnostic information.
|
||||
///
|
||||
/// If there is some state in a downstream crate you would like to
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue