Rename IntoDiagnostic
as Diagnostic
.
To match `derive(Diagnostic)`. Also rename `into_diagnostic` as `into_diag`.
This commit is contained in:
parent
a09b1d33a7
commit
7a294e998b
28 changed files with 146 additions and 164 deletions
|
@ -3,8 +3,8 @@ use std::num::NonZero;
|
|||
use rustc_ast::token;
|
||||
use rustc_ast::util::literal::LitError;
|
||||
use rustc_errors::{
|
||||
codes::*, Diag, DiagCtxt, DiagMessage, EmissionGuarantee, ErrorGuaranteed, IntoDiagnostic,
|
||||
Level, MultiSpan,
|
||||
codes::*, Diag, DiagCtxt, DiagMessage, Diagnostic, EmissionGuarantee, ErrorGuaranteed, Level,
|
||||
MultiSpan,
|
||||
};
|
||||
use rustc_macros::Diagnostic;
|
||||
use rustc_span::{Span, Symbol};
|
||||
|
@ -17,9 +17,9 @@ pub struct FeatureGateError {
|
|||
pub explain: DiagMessage,
|
||||
}
|
||||
|
||||
impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for FeatureGateError {
|
||||
impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for FeatureGateError {
|
||||
#[track_caller]
|
||||
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> Diag<'a, G> {
|
||||
fn into_diag(self, dcx: &'a DiagCtxt, level: Level) -> Diag<'a, G> {
|
||||
Diag::new(dcx, level, self.explain).with_span(self.span).with_code(E0658)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,8 +22,8 @@ use rustc_errors::emitter::{stderr_destination, DynEmitter, HumanEmitter, HumanR
|
|||
use rustc_errors::json::JsonEmitter;
|
||||
use rustc_errors::registry::Registry;
|
||||
use rustc_errors::{
|
||||
codes::*, fallback_fluent_bundle, Diag, DiagCtxt, DiagMessage, ErrorGuaranteed, FatalAbort,
|
||||
FluentBundle, IntoDiagnostic, LazyFallbackBundle, TerminalUrl,
|
||||
codes::*, fallback_fluent_bundle, Diag, DiagCtxt, DiagMessage, Diagnostic, ErrorGuaranteed,
|
||||
FatalAbort, FluentBundle, LazyFallbackBundle, TerminalUrl,
|
||||
};
|
||||
use rustc_macros::HashStable_Generic;
|
||||
pub use rustc_span::def_id::StableCrateId;
|
||||
|
@ -305,11 +305,7 @@ impl Session {
|
|||
}
|
||||
|
||||
#[track_caller]
|
||||
pub fn create_feature_err<'a>(
|
||||
&'a self,
|
||||
err: impl IntoDiagnostic<'a>,
|
||||
feature: Symbol,
|
||||
) -> Diag<'a> {
|
||||
pub fn create_feature_err<'a>(&'a self, err: impl Diagnostic<'a>, feature: Symbol) -> Diag<'a> {
|
||||
let mut err = self.dcx().create_err(err);
|
||||
if err.code.is_none() {
|
||||
#[allow(rustc::diagnostic_outside_of_impl)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue