File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
src/test/ui/const-generics Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ // This is currently not possible to use projections as const generics.
2+ // More information about this available here:
3+ // https://github.com/rust-lang/rust/pull/104443#discussion_r1029375633
4+
5+ pub trait Identity {
6+ type Identity ;
7+ }
8+
9+ impl < T > Identity for T {
10+ type Identity = Self ;
11+ }
12+
13+ pub fn foo < const X : <i32 as Identity >:: Identity > ( ) {
14+ //~^ ERROR
15+ assert ! ( X == 12 ) ;
16+ }
17+
18+ fn main ( ) {
19+ foo :: < 12 > ( ) ;
20+ }
Original file line number Diff line number Diff line change 1+ error: `<i32 as Identity>::Identity` is forbidden as the type of a const generic parameter
2+ --> $DIR/projection-as-arg-const.rs:13:21
3+ |
4+ LL | pub fn foo<const X: <i32 as Identity>::Identity>() {
5+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+ |
7+ = note: the only supported types are integers, `bool` and `char`
8+ = help: more complex types are supported with `#![feature(adt_const_params)]`
9+
10+ error: aborting due to previous error
11+
You can’t perform that action at this time.
0 commit comments