1
Fork 0

Restrict diagnostic context lifetime of InferCtxt to itself instead of TyCtxt

This commit is contained in:
Oli Scherer 2024-06-26 10:52:57 +00:00
parent 79ac8982ca
commit 5988078aa2
12 changed files with 79 additions and 53 deletions

View file

@ -88,7 +88,7 @@ impl<'tcx> InferCtxt<'tcx> {
found_args: Vec<ArgKind>,
is_closure: bool,
closure_arg_span: Option<Span>,
) -> Diag<'tcx> {
) -> Diag<'_> {
let kind = if is_closure { "closure" } else { "function" };
let args_str = |arguments: &[ArgKind], other: &[ArgKind]| {

View file

@ -3422,7 +3422,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
found_trait_ref: ty::TraitRef<'tcx>,
expected_trait_ref: ty::TraitRef<'tcx>,
terr: TypeError<'tcx>,
) -> Diag<'tcx> {
) -> Diag<'a> {
let self_ty = found_trait_ref.self_ty();
let (cause, terr) = if let ty::Closure(def_id, _) = self_ty.kind() {
(
@ -3553,7 +3553,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
})
.unwrap_or((found_span, None, found));
self.report_arg_count_mismatch(
self.infcx.report_arg_count_mismatch(
span,
closure_span,
expected,