trait solver: limit eager placeholder handling#158362
Conversation
|
rustbot has assigned @JonathanBrouwer. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
|
r? types |
9cc11df to
697770e
Compare
|
I'm not entirely sure if this is the right fix (I would actually expect that r? @BoxyUwU |
|
yeah, i think you're right that this probably is not the ideal long-term shape. what this pr does is more of a local bound: eager placeholder handling only walks universes the current solver region constraint can actually name. imo that part still makes sense to me. so yeah, idk if i would call this the best fix in the abstract. long term i'd expect us to have a cleaner invariant between created universes and placeholder assumptions, or maybe an explicit set of universes that eager handling should process. but for this pr, i still prefer this local fix over making missing assumptions silently mean ambiguity. if the constraint cannot name the universe, i don't think this pass should care about it. so this still lgtm to me as a short term fix, with the caveat that |
|
Offtopic: what does ltm mean? |
long term. |
|
this in theory makes sense as an optimization but it shouldn't make anything stop ICEing. We should not be entering binders inside of the trait solver without accounting for their assumptions 🤔
the set of universes it should handle is all of them (other than input universes). can you look into where/why we're entering a binder and not inserting assumptions for it |
yeah, you were right. i looked into where the unaccounted binder entry was happening, and it seems like the issue was in the bad path was basically: i changed the patch so eager handling keeps using all non-input universes. instead, when i also added the issue repro as a ui test. with this version it no longer ices and reports the overflow diagnostic instead. pushed this version for you to validate. idk if long-term we want |
fixes #157840
with
-zassumptions-on-binders, eager placeholder handling was walking up to the inference context's current universe, even when the current solver region constraint did not mention those universes. that made it ask for placeholder assumptions for unrelated universes and hit theunwrap()inget_placeholder_assumptions.this bounds the eager pass to the max universe actually present in the region constraint. imo that feels like the less spooky fix: idk why we would try to handle placeholders for universes the constraint cannot name. ltm, this keeps the existing assumptions machinery intact instead of making missing entries silently mean ambiguity.
also adds the issue repro as a ui test. lgtm locally with
x.py test tests/ui/assumptions_on_binders --stage 1 --force-rerun.