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

Don't Fold Self-Referential ADTs in check_inferred_predicates() #123866

Conversation

veera-sivarajan
Copy link
Contributor

Fixes #118163, #118449

The I-hang was caused by the compiler trying to instantiate a predicate for self-referential ADTs.

This PR fixes it by not instantiating a predicate when an ADT's field refers to the ADT itself.

@rustbot
Copy link
Collaborator

rustbot commented Apr 12, 2024

r? @BoxyUwU

rustbot has assigned @BoxyUwU.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 12, 2024
@compiler-errors
Copy link
Member

Can you please find what PR introduced this regression?

I'm also suspicious about if this is the right way to solve this problem -- there's no explanation of the side-effects of the change, nor any reasoning about if this affects soundness or anything like that. In general, I think this needs more explanation.

@veera-sivarajan
Copy link
Contributor Author

Sure! The issue bisects to #53793.

Will analyze more about soundness and update with a detailed explanation.

@BoxyUwU BoxyUwU 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-review Status: Awaiting review from the assignee but also interested parties. labels Apr 14, 2024
@veera-sivarajan
Copy link
Contributor Author

On second thought, this approach doesn't work for cases like:

trait Trait {
    type Assoc: Trait;
}

struct Outer<'a, T: Trait> {
    value: &'a Inner<'a, T>,
}

struct Inner<'a, T: Trait> {
    value: &'a Outer<'a, T::Assoc>,
}

Thanks for pointing it out.

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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Infinite loop in compiler
4 participants