Skip to content

Commit 484dc1f

Browse files
committed
update feature gate test
1 parent 0f0556b commit 484dc1f

File tree

2 files changed

+44
-3
lines changed

2 files changed

+44
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,43 @@
1+
error[E0658]: using `_` for array lengths is unstable
2+
--> $DIR/feature-gate-generic_arg_infer.rs:11:27
3+
|
4+
LL | let _x: [u8; 3] = [0; _];
5+
| ^
6+
|
7+
= note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information
8+
= help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable
9+
10+
error: in expressions, `_` can only be used on the left-hand side of an assignment
11+
--> $DIR/feature-gate-generic_arg_infer.rs:11:27
12+
|
13+
LL | let _x: [u8; 3] = [0; _];
14+
| ^ `_` not allowed here
15+
16+
error[E0658]: using `_` for array lengths is unstable
17+
--> $DIR/feature-gate-generic_arg_infer.rs:14:18
18+
|
19+
LL | let _y: [u8; _] = [0; 3];
20+
| ^
21+
|
22+
= note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information
23+
= help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable
24+
25+
error: in expressions, `_` can only be used on the left-hand side of an assignment
26+
--> $DIR/feature-gate-generic_arg_infer.rs:14:18
27+
|
28+
LL | let _y: [u8; _] = [0; 3];
29+
| ^ `_` not allowed here
30+
131
error[E0747]: type provided when a constant was expected
2-
--> $DIR/feature-gate-generic_arg_infer.rs:11:20
32+
--> $DIR/feature-gate-generic_arg_infer.rs:20:20
333
|
434
LL | let _x = foo::<_>([1,2]);
535
| ^
636
|
737
= help: const arguments cannot yet be inferred with `_`
838
= help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable
939

10-
error: aborting due to previous error
40+
error: aborting due to 5 previous errors
1141

12-
For more information about this error, try `rustc --explain E0747`.
42+
Some errors have detailed explanations: E0658, E0747.
43+
For more information about an error, try `rustc --explain E0658`.

src/test/ui/feature-gates/feature-gate-generic_arg_infer.rs

+10
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,17 @@ fn foo<const N: usize>(_: [u8; N]) -> [u8; N] {
77
[0; N]
88
}
99

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+
1019
fn main() {
1120
let _x = foo::<_>([1,2]);
1221
//[normal]~^ ERROR: type provided when a constant was expected
22+
let _y = bar();
1323
}

0 commit comments

Comments
 (0)