File tree 2 files changed +40
-0
lines changed
src/test/ui/const-generics
2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ #![ feature( const_generics) ]
2
+ //~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
3
+
4
+ pub struct MyArray < const COUNT : usize > ( [ u8 ; COUNT + 1 ] ) ;
5
+ //~^ ERROR constant expression depends on a generic parameter
6
+
7
+ impl < const COUNT : usize > MyArray < COUNT > {
8
+ fn inner ( & self ) -> & [ u8 ; COUNT + 1 ] {
9
+ //~^ ERROR constant expression depends on a generic parameter
10
+ & self . 0
11
+ }
12
+ }
13
+
14
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ warning: the feature `const_generics` is incomplete and may cause the compiler to crash
2
+ --> $DIR/issue-61522-array-len-succ.rs:1:12
3
+ |
4
+ LL | #![feature(const_generics)]
5
+ | ^^^^^^^^^^^^^^
6
+ |
7
+ = note: `#[warn(incomplete_features)]` on by default
8
+
9
+ error: constant expression depends on a generic parameter
10
+ --> $DIR/issue-61522-array-len-succ.rs:4:40
11
+ |
12
+ LL | pub struct MyArray<const COUNT: usize>([u8; COUNT + 1]);
13
+ | ^^^^^^^^^^^^^^^
14
+ |
15
+ = note: this may fail depending on what value the parameter takes
16
+
17
+ error: constant expression depends on a generic parameter
18
+ --> $DIR/issue-61522-array-len-succ.rs:8:24
19
+ |
20
+ LL | fn inner(&self) -> &[u8; COUNT + 1] {
21
+ | ^^^^^^^^^^^^^^^^
22
+ |
23
+ = note: this may fail depending on what value the parameter takes
24
+
25
+ error: aborting due to 2 previous errors
26
+
You can’t perform that action at this time.
0 commit comments