Skip to content

creating a TypeErrCtxt should only be possible if we emit an error #108810

Closed
@lcnr

Description

@lcnr

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-type-systemArea: Type systemC-cleanupCategory: PRs that clean code up or issues documenting cleanup.E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions