We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 47ecded + 17ba73c commit ef5e401Copy full SHA for ef5e401
src/doc/unstable-book/src/language-features/adt-const-params.md
@@ -0,0 +1,35 @@
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
+use std::marker::ConstParamTy;
16
17
+#[derive(ConstParamTy, PartialEq, Eq)]
18
+enum Foo {
19
+ A,
20
+ B,
21
+ C,
22
+}
23
24
25
+struct Bar {
26
+ flag: bool,
27
28
29
+fn is_foo_a_and_bar_true<const F: Foo, const B: Bar>() -> bool {
30
+ match (F, B.flag) {
31
+ (Foo::A, true) => true,
32
+ _ => false,
33
+ }
34
35
+```
0 commit comments