File tree 2 files changed +37
-0
lines changed
src/test/ui/const-generics
2 files changed +37
-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
+ fn foo < const X : u32 > ( ) {
5
+ //~^ ERROR const generics in any position are currently unsupported
6
+ fn bar ( ) -> u32 {
7
+ X //~ ERROR can't use generic parameters from outer function
8
+ }
9
+ }
10
+
11
+ 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/const-param-from-outer-fn.rs:1:12
3
+ |
4
+ LL | #![feature(const_generics)]
5
+ | ^^^^^^^^^^^^^^
6
+
7
+ error[E0401]: can't use generic parameters from outer function
8
+ --> $DIR/const-param-from-outer-fn.rs:7:9
9
+ |
10
+ LL | fn foo<const X: u32>() {
11
+ | - const variable from outer function
12
+ LL | //~^ ERROR const generics in any position are currently unsupported
13
+ LL | fn bar() -> u32 {
14
+ | --- try adding a local generic parameter in this method instead
15
+ LL | X //~ ERROR can't use generic parameters from outer function
16
+ | ^ use of generic parameter from outer function
17
+
18
+ error: const generics in any position are currently unsupported
19
+ --> $DIR/const-param-from-outer-fn.rs:4:14
20
+ |
21
+ LL | fn foo<const X: u32>() {
22
+ | ^
23
+
24
+ error: aborting due to 2 previous errors
25
+
26
+ For more information about this error, try `rustc --explain E0401`.
You can’t perform that action at this time.
0 commit comments