Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Make cycle errors recoverable #102037

Merged
merged 3 commits into from
Sep 22, 2022
Merged

Make cycle errors recoverable #102037

merged 3 commits into from
Sep 22, 2022

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Sep 20, 2022

In particular, this allows rustdoc to recover from cycle errors when normalizing associated types for documentation.

In the past, @jackh726 has said we need to be careful about overflow errors: #91430 (comment)

Off the top of my head, we definitely should be careful about treating overflow errors the same as
"not implemented for some reason" errors. Otherwise, you could end up with behavior that is
different depending on recursion depth. But, that might be context-dependent.

But cycle errors should be safe to unconditionally report; they don't depend on the recursion depth, they will always be an error whenever they're encountered.

Helps with #81091.

r? @lcnr cc @matthewjasper

This avoids toil when changing other functions in `ObligationForest` to take an `OUT` parameter.
In particular, this allows rustdoc to recover from cycle errors when normalizing associated types for documentation.

In the past, `@jackh726` has said we need to be careful about overflow errors:

> Off the top of my head, we definitely should be careful about treating overflow errors the same as
"not implemented for some reason" errors. Otherwise, you could end up with behavior that is
different depending on recursion depth. But, that might be context-dependent.

But cycle errors should be safe to unconditionally report; they don't depend on the recursion depth, they will always be an error whenever they're encountered.
@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Sep 20, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 20, 2022
@lcnr
Copy link
Contributor

lcnr commented Sep 20, 2022

that seems fine to me, even recursion limit errors should be alright. cc @rust-lang/types

@bors r+

@bors
Copy link
Contributor

bors commented Sep 20, 2022

📌 Commit 1512ce5 has been approved by lcnr

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 20, 2022
if let FulfillmentErrorCode::CodeCycle(cycle) = err.code {
infcx.report_overflow_error_cycle(&cycle);
}
}
Copy link
Contributor

@lcnr lcnr Sep 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's a bit unfortunate, but seems acceptable for now and something we can definitely fixchange later.

Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Sep 20, 2022
Make cycle errors recoverable

In particular, this allows rustdoc to recover from cycle errors when normalizing associated types for documentation.

In the past, `@jackh726` has said we need to be careful about overflow errors: rust-lang#91430 (comment)

> Off the top of my head, we definitely should be careful about treating overflow errors the same as
"not implemented for some reason" errors. Otherwise, you could end up with behavior that is
different depending on recursion depth. But, that might be context-dependent.

But cycle errors should be safe to unconditionally report; they don't depend on the recursion depth, they will always be an error whenever they're encountered.

Helps with rust-lang#81091.

r? `@lcnr` cc `@matthewjasper`
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Sep 22, 2022
Make cycle errors recoverable

In particular, this allows rustdoc to recover from cycle errors when normalizing associated types for documentation.

In the past, ``@jackh726`` has said we need to be careful about overflow errors: rust-lang#91430 (comment)

> Off the top of my head, we definitely should be careful about treating overflow errors the same as
"not implemented for some reason" errors. Otherwise, you could end up with behavior that is
different depending on recursion depth. But, that might be context-dependent.

But cycle errors should be safe to unconditionally report; they don't depend on the recursion depth, they will always be an error whenever they're encountered.

Helps with rust-lang#81091.

r? ``@lcnr`` cc ``@matthewjasper``
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 22, 2022
Rollup of 8 pull requests

Successful merges:

 - rust-lang#101598 (Update rustc's information on Android's sanitizers)
 - rust-lang#102036 (Remove use of `io::ErrorKind::Other` in std)
 - rust-lang#102037 (Make cycle errors recoverable)
 - rust-lang#102069 (Skip `Equate` relation in `handle_opaque_type`)
 - rust-lang#102076 (rustc_transmute: fix big-endian discriminants)
 - rust-lang#102107 (Add missing space between notable trait tooltip and where clause)
 - rust-lang#102119 (Fix a typo “pararmeter” in error message)
 - rust-lang#102131 (Added which number is computed in compute_float.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors
Copy link
Contributor

bors commented Sep 22, 2022

☔ The latest upstream changes (presumably #102139) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 22, 2022
@bors bors merged commit d5ae673 into rust-lang:master Sep 22, 2022
@rustbot rustbot added this to the 1.66.0 milestone Sep 22, 2022
@jyn514 jyn514 deleted the normalize-docs branch September 28, 2022 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants