-
Notifications
You must be signed in to change notification settings - Fork 13.4k
typeck: remove leaky nested probe during trait object method resolution #57835
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
typeck: remove leaky nested probe during trait object method resolution #57835
Conversation
In particular, the table entries (associated with type-variables created during the probe) must persist as long as the candidates assembled during the probe. If you make a nested probe without creating a nested `ProbeContext`, the table entries are popped at the end of the nested probe, while the type-variables would leak out via the assembled candidates attached to `self` (the outer `ProbeContext`). This causes an ICE (*if you are lucky*)!
r? @oli-obk (rust_highfive has picked a reviewer for you, use r? to override) |
cc @arielb1 |
while working on debugging this problem, I mused that it might be good for |
beta nominated because #57673 reproduces on beta channel now. |
This doesn't quite feel like the right solution to me, because it forces the |
I need to think this a bit more through. |
So I think this is OK for now, and I'll come up with a better fix soon-ish @bors r+ p=1 |
📌 Commit 33c2ceb has been approved by |
☀️ Test successful - checks-travis, status-appveyor |
discussed at T-compiler meeting. We're going to postpone the decision about whether to backport to beta for (at least) a week, to both see what the impact of this change is on nightly, and to also give @arielb1 a chance to show the better fix they are proposing. Also: @arielb1 : if you do not have time to develop the fix, it would be good in the meantime to post code demonstrating the problem(s) you foresee with the change as written. |
Avoid committing to autoderef in object method probing This fixes the "leak" introduced in #57835 (see test for details, also apparently #54252 had no tests for the "leaks" that were fixed in it, so go ahead and add one). Maybe beta-nominating because regression, but I'm against landing things on beta we don't have to. r? @nikomatsakis
[beta] Rollup backports Cherry-picked: * #58207: Make `intern_lazy_const` actually intern its argument. * #58161: Lower constant patterns with ascribed types. * #57908: resolve: Fix span arithmetics in the import conflict error * #57835: typeck: remove leaky nested probe during trait object method resolution * #57885: Avoid committing to autoderef in object method probing * #57646: Fixes text becoming invisible when element targetted Rolled up: * #58522: [BETA] Update cargo r? @ghost
[beta] Rollup backports Cherry-picked: * #58207: Make `intern_lazy_const` actually intern its argument. * #58161: Lower constant patterns with ascribed types. * #57908: resolve: Fix span arithmetics in the import conflict error * #57835: typeck: remove leaky nested probe during trait object method resolution * #57885: Avoid committing to autoderef in object method probing * #57646: Fixes text becoming invisible when element targetted Rolled up: * #58522: [BETA] Update cargo r? @ghost
addresses #57673 (but not marking with f-x because thats now afflicting beta channel).
Fix #57216