File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
src/doc/unstable-book/src/language-features Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change
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
+ #[derive(ConstParamTy, PartialEq, Eq)]
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
+ ```
You can’t perform that action at this time.
0 commit comments