]> git.proxmox.com Git - rustc.git/blob - tests/ui/feature-gates/feature-gate-generic_arg_infer.rs
New upstream version 1.72.1+dfsg1
[rustc.git] / tests / ui / feature-gates / feature-gate-generic_arg_infer.rs
1 // [feature] run-pass
2 // revisions: normal feature
3
4 #![cfg_attr(feature, feature(generic_arg_infer))]
5
6 fn foo<const N: usize>(_: [u8; N]) -> [u8; N] {
7 [0; N]
8 }
9
10 fn bar() {
11 let _x: [u8; 3] = [0; _];
12 //[normal]~^ ERROR: using `_` for array lengths is unstable
13 //[normal]~| ERROR: in expressions, `_` can only be used on the left-hand side of an assignment
14 let _y: [u8; _] = [0; 3];
15 //[normal]~^ ERROR: using `_` for array lengths is unstable
16 //[normal]~| ERROR: in expressions, `_` can only be used on the left-hand side of an assignment
17 }
18
19 fn main() {
20 let _x = foo::<_>([1,2]);
21 //[normal]~^ ERROR: type provided when a constant was expected
22 bar();
23 }