-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Bad associated type usage causes infinite build/check/run #76187
Comments
A slightly more minimized example:
|
I've started to dig into this a little. I think there is an infinite loop happening in the implict outlives bit of typechecking. Basically, the I've reached my time limit for now, but here a gist of a full debug log into a couple cycles of this loop in case in it would be helpful to anyone (or just me later): https://gist.github.com/jackh726/0ac343d575d1aca3d786b7773a3c0401 |
Okay, digging in some more. In outlives checking, here's the sequence of events I'm seeing: We ask for required predicates for This is a new "global predicate", so we add it to map. Next round: We ask for required predicates for: This is a new "global predicate", so we add it to map. repeat Have to think of a proper solution here. |
Much shorter repro
|
Very short repro that doesn't use GATs
|
This looks a lot like #63650. As this isn't a GAT issue, I'm removing that label. |
I don't know anything 😇 just skimming Rust source to see how it works... and tracing a few nontrivial issues (with easy repro cases) to try to motivate my understanding. Seeing this one, it made me curious about how cycles are ever handled in datatypes--lifetime or not. I found a comment in the definition of Adt which says:
Perhaps worth noticing. Anyway, looking at this case, there is ( Note: Circa October 2022, the cited code is located in So there's a DefId on the left hand side of the map. In the repro case that's not exploding with IDs (it just flips back and forth between a single ID for each of Elem and List, but those two IDs are mapping to an ever-increasing amount of stuff.) Here's a targeted debug dump of that, which adds some type information to what @jackh726 has already summarized:
That first argument to OutlivesPredicate is a
The terminology is that T is a
The substitution that turns
What happens is that the GenericArg gets walked through deeply running "Type Folding". TypeFoldable is implemented for GenericArg, which when it contains a Type (vs Region/Const) it runs this code:
When the |
Bad: compilation never completes
Good: compilation completes
Common
The text was updated successfully, but these errors were encountered: