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
|
@ -341,7 +341,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||
multi_suggestions,
|
||||
bad_label,
|
||||
}
|
||||
.into_diagnostic(&self.tcx.sess.parse_sess),
|
||||
.into_diagnostic(&self.tcx.sess.parse_sess.span_diagnostic),
|
||||
TypeAnnotationNeeded::E0283 => AmbigousImpl {
|
||||
span,
|
||||
source_kind,
|
||||
|
@ -351,7 +351,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||
multi_suggestions,
|
||||
bad_label,
|
||||
}
|
||||
.into_diagnostic(&self.tcx.sess.parse_sess),
|
||||
.into_diagnostic(&self.tcx.sess.parse_sess.span_diagnostic),
|
||||
TypeAnnotationNeeded::E0284 => AmbigousReturn {
|
||||
span,
|
||||
source_kind,
|
||||
|
@ -361,7 +361,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||
multi_suggestions,
|
||||
bad_label,
|
||||
}
|
||||
.into_diagnostic(&self.tcx.sess.parse_sess),
|
||||
.into_diagnostic(&self.tcx.sess.parse_sess.span_diagnostic),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -537,7 +537,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||
multi_suggestions,
|
||||
bad_label: None,
|
||||
}
|
||||
.into_diagnostic(&self.tcx.sess.parse_sess),
|
||||
.into_diagnostic(&self.tcx.sess.parse_sess.span_diagnostic),
|
||||
TypeAnnotationNeeded::E0283 => AmbigousImpl {
|
||||
span,
|
||||
source_kind,
|
||||
|
@ -547,7 +547,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||
multi_suggestions,
|
||||
bad_label: None,
|
||||
}
|
||||
.into_diagnostic(&self.tcx.sess.parse_sess),
|
||||
.into_diagnostic(&self.tcx.sess.parse_sess.span_diagnostic),
|
||||
TypeAnnotationNeeded::E0284 => AmbigousReturn {
|
||||
span,
|
||||
source_kind,
|
||||
|
@ -557,7 +557,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||
multi_suggestions,
|
||||
bad_label: None,
|
||||
}
|
||||
.into_diagnostic(&self.tcx.sess.parse_sess),
|
||||
.into_diagnostic(&self.tcx.sess.parse_sess.span_diagnostic),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -575,7 +575,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||
span,
|
||||
generator_kind: GeneratorKindAsDiagArg(kind),
|
||||
}
|
||||
.into_diagnostic(&self.tcx.sess.parse_sess)
|
||||
.into_diagnostic(&self.tcx.sess.parse_sess.span_diagnostic)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue