You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: posts/inside-rust/2025-03-07-inferred-const-generic-arguments.md
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ fn foo() {
19
19
}
20
20
```
21
21
22
-
This is entirely a syntactic limitation; writing `_` is disallowed but it is still possible to elide generic argument listings that may involve const arguments:
22
+
This is entirely a syntactic limitation; it is possible to entirely elide generic argument listings that may involve const arguments:
23
23
```rust
24
24
fnfoo<constN:usize>(_: [u8; N]) {}
25
25
@@ -34,7 +34,7 @@ fn bar() {
34
34
35
35
The compiler has always been able to infer values for const generic parameters, only the ability to explicitly ask for a const argument to be inferred is unstable.
36
36
37
-
`feature(generic_arg_infer)`also allows you to infer the length of a repeat expression. This was previously not possible without moving the expression into a separate function generic over the array length.
37
+
It is currently also not possible to the infer the length of a repeat expression. Doing so would require moving the expression into a separate function generic over the array length.
38
38
39
39
```rust
40
40
fnfoo() {
@@ -43,17 +43,17 @@ fn foo() {
43
43
}
44
44
```
45
45
46
-
This feature allows all of the previous examples to compile, which should hopefully feel like something that should "obviously" be supported by Rust.
46
+
With `feature(generic_arg_infer)`all of the previous examples compile. This should hopefully feel like something that should "obviously" be supported by Rust.
47
47
48
48
## What comes next
49
49
50
50
We have [significantly reworked the implementation](https://github.com/rust-lang/rust/pull/135272) of this recently and it should now be ready for stabilization. We'd love for you to try it out on a recent nightly and report any issues you encounter.
51
51
52
52
## Acknowledgements
53
53
54
-
My recent push to make this feature ready for testing would not have been possible without the help of many others.
54
+
My recent push to make this feature ready for testing would not have been possible without the help of many others:
55
55
56
-
[@lcnr][lcnr] and [@JulianKnodt][JulianKnodt] for the initial implementation of `generic_arg_infer`, [@camelid][camelid] for refactoring our representation of const geneic arguments to be more flexible, [@voidc][voidc] for helping unify the way we operate on array lengths and const generic arguments, [@lcnr][lcnr] for design work on abstracting away differences between inferred type/const/generic arguments, and finally [@compiler-errors][compiler-errors] for reviewing many PRs and implementation decisions made as part of work on this feature.
56
+
A big thank you to [@lcnr][lcnr] and [@JulianKnodt][JulianKnodt] for the initial implementation of `generic_arg_infer`, [@camelid][camelid] for refactoring our representation of const generic arguments to be more flexible, [@voidc][voidc] for helping unify the way we operate on array lengths and const generic arguments, [@lcnr][lcnr] for design work on abstracting away differences between inferred type/const/generic arguments, and finally [@compiler-errors][compiler-errors] for reviewing many PRs and implementation decisions made as part of work on this feature.
0 commit comments