Description
This is a tracking issue for the RFC GenericArg::Infer
The feature gate for the issue is #![feature(generic_arg_infer)]
.
What is GenericArg::Infer
?
Currently, rustc supports type inference. That is, given a function fn(T)
, it can infer the type of T based on its usage. Const-generics also has limited support for inference, such as for arrays, we can infer N: usize
in some usages [T; N]
. In order to expand inference for consts, it's necessary to lift the current specialized type Ty::Infer
into GenericArg::Infer
, as GenericArg
covers both consts and types, whereas Ty::Infer
can only be used in the place of types. This will eventually allow for consts to be inferred in all the same locations as types.
About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Steps
- Implement the RFC (Add hir::GenericArg::Infer #83484)
- Solve
generic_arg_infer
impl is prone to bugs in hir visitors #112110 - Adjust documentation (see instructions on rustc-dev-guide)
- Stabilization PR (see instructions on rustc-dev-guide)
Unresolved Questions
- Should
hir::Ty::Infer
be removed? No just make it unreachable for hir visitors and inGenericArg::Ty
position