-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat: type inference for generic associated types #13494
Conversation
I've run analysis-stats on self and std, confirmed it doesn't crash and the numbers don't change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, surprisingly few changes. Maybe we can simplify the lowering code in the future.
@bors d+
let a = *p; | ||
} | ||
"#, | ||
expect![[r#" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in general, I want to get rid of the expect tests and move to check
etc., because they're more flexible and it's a bit clearer what we're actually testing (vs. what's just incidental code)
@bors d+ |
Forgot that old bors doesn't understand d+ 😅 Anyway, it's probably fine to just merge anyway. @bors r+ |
I think bors doesn't have d+ but delegate+? I can replace the expect test with appropriate one in a few hours (a follow-up PR would also suffice though). |
☀️ Test successful - checks-actions |
Yes, it's delegate+. I didn't think it was really necessary to hold up the PR on that though 😄 |
Ahh I see. Thanks so much for your quick review by the way, I'm really relieved to get this merged before GATs come to stable! |
Clean up tests and add documentation for GATs related stuff This is a follow-up PR for #13494. - addresses #13494 (comment) - documents the ordering constraint on `Binders` and `Substitution` (which is not really follow-up for the previous PR, but it was introduced to support GATs and I strongly feel it's worth it)
Auto merge of #13505 - lowr:feat/gats, r=flodiebold Clean up tests and add documentation for GATs related stuff This is a follow-up PR for #13494. - addresses rust-lang/rust-analyzer#13494 (comment) - documents the ordering constraint on `Binders` and `Substitution` (which is not really follow-up for the previous PR, but it was introduced to support GATs and I strongly feel it's worth it)
This PR implements type inference for generic associated types. Basically, this PR lowers generic arguments for associated types in valid places and creates
Substitution
s for them.I focused on the inference for correct Rust programs, so there are cases where we accidentally manage to infer things that are actually invalid (which would then be reported by flycheck so I deem them non-fatal). See the following tests and FIXME notes on them:
gats_with_dyn
,gats_with_impl_trait
.The added tests are rather arbitrary. Let me know if there are cases I'm missing or I should add.
Closes #9673