]> git.lizzy.rs Git - rust.git/blob - tests/ui/const-generics/generic_arg_infer/in-signature.rs
Auto merge of #106503 - cjgillot:remap-nofilter, r=oli-obk
[rust.git] / tests / ui / const-generics / generic_arg_infer / in-signature.rs
1 #![crate_type = "rlib"]
2 #![feature(generic_arg_infer)]
3
4 struct Foo<const N: usize>;
5 struct Bar<T, const N: usize>(T);
6
7 fn arr_fn() -> [u8; _] {
8     //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types
9     [0; 3]
10 }
11
12 fn ty_fn() -> Bar<i32, _> {
13     //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types
14     Bar::<i32, 3>(0)
15 }
16
17 fn ty_fn_mixed() -> Bar<_, _> {
18     //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types
19     Bar::<i32, 3>(0)
20 }
21
22 const ARR_CT: [u8; _] = [0; 3];
23 //~^ ERROR the placeholder `_` is not allowed within types on item signatures for constants
24 static ARR_STATIC: [u8; _] = [0; 3];
25 //~^ ERROR the placeholder `_` is not allowed within types on item signatures for static variables
26 const TY_CT: Bar<i32, _> = Bar::<i32, 3>(0);
27 //~^ ERROR the placeholder `_` is not allowed within types on item signatures for constants
28 static TY_STATIC: Bar<i32, _> = Bar::<i32, 3>(0);
29 //~^ ERROR the placeholder `_` is not allowed within types on item signatures for static variables
30 const TY_CT_MIXED: Bar<_, _> = Bar::<i32, 3>(0);
31 //~^ ERROR the placeholder `_` is not allowed within types on item signatures for constants
32 static TY_STATIC_MIXED: Bar<_, _> = Bar::<i32, 3>(0);
33 //~^ ERROR the placeholder `_` is not allowed within types on item signatures for static variables
34 trait ArrAssocConst {
35     const ARR: [u8; _];
36     //~^ ERROR the placeholder `_` is not allowed within types on item signatures for constants
37 }
38 trait TyAssocConst {
39     const ARR: Bar<i32, _>;
40     //~^ ERROR the placeholder `_` is not allowed within types on item signatures for constants
41 }
42 trait TyAssocConstMixed {
43     const ARR: Bar<_, _>;
44     //~^ ERROR the placeholder `_` is not allowed within types on item signatures for constants
45 }
46
47 trait AssocTy {
48     type Assoc;
49 }
50 impl AssocTy for i8 {
51     type Assoc = [u8; _];
52     //~^ ERROR the placeholder `_` is not allowed within types on item signatures for associated types
53 }
54 impl AssocTy for i16 {
55     type Assoc = Bar<i32, _>;
56     //~^ ERROR the placeholder `_` is not allowed within types on item signatures for associated types
57 }
58 impl AssocTy for i32 {
59     type Assoc = Bar<_, _>;
60     //~^ ERROR the placeholder `_` is not allowed within types on item signatures for associated types
61 }