2021-Oct: Lang team update
Summary
- GATs are moving towards stabilization. Major blockers:
- Resolving the default inference question we discussed earlier (plan described below)
- Resolving the syntax of where clauses
- Explainer that covers common usage patterns
- Documenting test coverage
- Triage known bugs
- Since we landed various improvements, jackh726 has been monitoring bugs, many of them are general issues with rustc that come up somewhat more often for GATs
Goals for this month
- Implement default inference solution
- Settle question of whre clause syntax
- Finish explainer and issue triage
Notes
The general plan is to push Generated Associated types towards stabilization, but with the expectation that the current form has ergonomic pitfalls. You can think of it as an MVP to expose functionality. Towards that end we aim to write an explainer that highlights the current state of the feature, what it can do, and what it can't.
Resolving the question of where clause defaults
Last month we discussed a potential defaulting scheme for where Self: 'a
annotations. There were some unknowns, such as the "false default" rate -- i.e., cases where the default would trigger but you don't want it. To help gain more data, the plan is to implement the logic for adding a default, but instead of adding a default, we will require that the default be written explicitly. You can think of it as an extended "well-formedness" requirement.
This preserves future flexibility:
- Remove the error altogether
- Add as a lint with a fix
- Simply add the where clause by default, perhaps with an opt out
The error message for this default will include instructions on (a) known workarounds if it is not desired and (b) an issue where folks can comment if they have codebases where the default was not helpful. This should enable us to gain some data.