Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Closed
lcnr opened this issue Mar 6, 2023 · 0 comments
Closed

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

lcnr opened this issue Mar 6, 2023 · 0 comments
Labels
A-type-system Area: Type system C-cleanup Category: PRs that clean code up or issues documenting cleanup. E-medium Call for participation: Medium difficulty. Experience needed to fix: Intermediate. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@lcnr
Copy link
Contributor

lcnr commented Mar 6, 2023

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

@lcnr lcnr added C-cleanup Category: PRs that clean code up or issues documenting cleanup. A-type-system Area: Type system labels Mar 6, 2023
@estebank estebank added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Mar 7, 2023
@lcnr lcnr added the E-medium Call for participation: Medium difficulty. Experience needed to fix: Intermediate. label Mar 20, 2023
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Apr 13, 2023
cleanup our region error API

- require `TypeErrCtxt` to always result in an error, closing rust-lang#108810
- move `resolve_regions_and_report_errors` to the `ObligationCtxt`
- call `process_registered_region_obligations` in `resolve_regions`
- move `resolve_regions` into the `outlives` submodule
- add `#[must_use]` to functions returning lists of errors

r? types
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Apr 13, 2023
cleanup our region error API

- require `TypeErrCtxt` to always result in an error, closing rust-lang#108810
- move `resolve_regions_and_report_errors` to the `ObligationCtxt`
- call `process_registered_region_obligations` in `resolve_regions`
- move `resolve_regions` into the `outlives` submodule
- add `#[must_use]` to functions returning lists of errors

r? types
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Apr 13, 2023
cleanup our region error API

- require `TypeErrCtxt` to always result in an error, closing rust-lang#108810
- move `resolve_regions_and_report_errors` to the `ObligationCtxt`
- call `process_registered_region_obligations` in `resolve_regions`
- move `resolve_regions` into the `outlives` submodule
- add `#[must_use]` to functions returning lists of errors

r? types
@lcnr lcnr closed this as completed Apr 13, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-type-system Area: Type system C-cleanup Category: PRs that clean code up or issues documenting cleanup. E-medium Call for participation: Medium difficulty. Experience needed to fix: Intermediate. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants