We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
adt_const_params
1 parent 13471d3 commit 627a2e2Copy full SHA for 627a2e2
src/doc/unstable-book/src/language-features/adt-const-params.md
@@ -0,0 +1,33 @@
1
+# `adt_const_params`
2
+
3
+The tracking issue for this feature is: [#95174]
4
5
+[#95174]: https://github.com/rust-lang/rust/issues/95174
6
7
+------------------------
8
9
+Allows for using more complex types for const parameters, such as structs or enums.
10
11
+```rust
12
+#![feature(adt_const_params)]
13
+#![allow(incomplete_features)]
14
15
+#[derive(ConstParamTy, PartialEq, Eq)]
16
+enum Foo {
17
+ A,
18
+ B,
19
+ C,
20
+}
21
22
23
+struct Bar {
24
+ flag: bool,
25
26
27
+fn is_foo_a_and_bar_true<const F: Foo, const B: Bar>() -> bool {
28
+ match (F, B.flag) {
29
+ (Foo::A, true) => true,
30
+ _ => false,
31
+ }
32
33
+```
0 commit comments