UPDATE - into_diagnostic to take a Handler instead of a ParseSess
Suggested by the team in this Zulip Topic https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20SessionDiagnostic.20on.20Handler Handler already has almost all the capabilities of ParseSess when it comes to diagnostic emission, in this migration we only needed to add the ability to access source_map from the emitter in order to get a Snippet and the start_point. Not sure if this is the best way to address this gap
This commit is contained in:
parent
a2cdcb3fea
commit
321e60bf34
14 changed files with 85 additions and 57 deletions
|
@ -1,7 +1,7 @@
|
|||
use rustc_errors::{fluent, ErrorGuaranteed};
|
||||
use rustc_errors::{fluent, ErrorGuaranteed, Handler};
|
||||
use rustc_macros::SessionDiagnostic;
|
||||
use rustc_middle::ty::{PolyTraitRef, Ty, Unevaluated};
|
||||
use rustc_session::{parse::ParseSess, Limit, SessionDiagnostic};
|
||||
use rustc_session::{Limit, SessionDiagnostic};
|
||||
use rustc_span::{Span, Symbol};
|
||||
|
||||
#[derive(SessionDiagnostic)]
|
||||
|
@ -69,9 +69,9 @@ pub struct NegativePositiveConflict<'a> {
|
|||
impl SessionDiagnostic<'_> for NegativePositiveConflict<'_> {
|
||||
fn into_diagnostic(
|
||||
self,
|
||||
sess: &ParseSess,
|
||||
handler: &Handler,
|
||||
) -> rustc_errors::DiagnosticBuilder<'_, ErrorGuaranteed> {
|
||||
let mut diag = sess.struct_err(fluent::trait_selection::negative_positive_conflict);
|
||||
let mut diag = handler.struct_err(fluent::trait_selection::negative_positive_conflict);
|
||||
diag.set_arg("trait_desc", self.trait_desc);
|
||||
diag.set_arg(
|
||||
"self_desc",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue