-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
[WIP] rustc: avoid checking Trait's predicates for WF(<T as Trait>::X). #66020
Conversation
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Ping from triage: cc: @nikomatsakis Thanks! |
Sorry, this is waiting for a review, I should've mentioned I didn't fully address the test failures because it's not clear what the correct outcome is. |
Ping from triage, it's been a week since this was last touched. Thanks! |
My take is this: This may well be sound but it's not obviously so. I would prefer to look at steps to avoid merging the where clauses from associated types into the trait listing -- I believe that would have a similar effect to this PR and just be generally less work overall (and a closer match to what chalk does). However, such a change might have some subtle effects on very strange code. Notably, I imagine that if a user wrote this: trait Foo where Self::Bar: Display {
type Bar;
} that is today probably equivalent to trait Foo {
type Bar: Display;
} but under the most straightforward version of the code I am imagining, it would no longer be (although, now that I think about it, I think that implied bounds in chalk might ultimately judge them to be equivalent regardless). |
8807a70
to
7a82867
Compare
While I don't expect this to land, I am curious how perf would measure the impact. @bors try |
⌛ Trying commit 7a82867 with merge fad7de5f0bbacf986f3cf2baa8006b977b6e2107... |
@rust-timer queue |
Awaiting bors try build completion |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
☀️ Try build successful - checks-azure |
Queued fad7de5f0bbacf986f3cf2baa8006b977b6e2107 with parent 797fd92, future comparison URL. |
Finished benchmarking try commit fad7de5f0bbacf986f3cf2baa8006b977b6e2107, comparison URL. |
At a first glance, that might be so, but consider that now every place, which used One of those places is the very one modified by this PR! So moving associated type bounds off of the trait |
[WIP] [DO NOT MERGE] combine #66020 and #66821. That is, the two fixes for #65510, and only for perf testing purposes. The fact that they both work to a comparable extent, while touching different parts of the trait system, made me curious if there would be any gains from having both. r? @nikomatsakis
Yes, I agree that this would be a larger change, though it wouldn't concern me for soundness per se. I might be concerned about bits of code that used to compile no longer doing so. |
ping from triage, @eddyb any update after niko's comment? Should we try a crater run or so? |
Fixes #65510 - specifically, this is the WF disabling patch mentioned in #65510 (comment).
This is marked WIP to avoid merging it without serious scrutiny, since there's a chance this is unsound.
In case this doesn't work out, we can probably try caching proving WF obligations (perhaps when no type/const inference variables are involved? in general we could try to use queries more).
r? @nikomatsakis