there are a lot of methods on TypeErrCtxt which should only be used for diagnostics. To assert that this is the case we should emit a delay_span_bug when creating (or probably when dropping so that -Ztreat-err-as-bug keeps working nicely) this context.
This means that we can't use infcx.err_ctxt().check_region_obligations_and_report_errors() as that creates a TypeErrCtxt even though we don't emit any error.
Its probably easiest to use the same split as select_all_or_error, always using resolve_regions which returns a #[must_use] list of errors and then manually calling report_region_errors
there are a lot of methods on
TypeErrCtxtwhich should only be used for diagnostics. To assert that this is the case we should emit adelay_span_bugwhen creating (or probably when dropping so that-Ztreat-err-as-bugkeeps working nicely) this context.This means that we can't use
infcx.err_ctxt().check_region_obligations_and_report_errors()as that creates aTypeErrCtxteven though we don't emit any error.Its probably easiest to use the same split as
select_all_or_error, always usingresolve_regionswhich returns a#[must_use]list of errors and then manually callingreport_region_errors