]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/const-generics/invalid-enum.rs
1 #![feature(const_generics)]
2 #![allow(incomplete_features)]
4 #[derive(PartialEq, Eq)]
10 pub fn test_1
<const CF
: CompileFlag
>() {}
11 pub fn test_2
<T
, const CF
: CompileFlag
>(x
: T
) {}
12 pub struct Example
<const CF
: CompileFlag
, T
=u32>{
16 impl<const CF
: CompileFlag
, T
> Example
<CF
, T
> {
17 const ASSOC_FLAG
: CompileFlag
= CompileFlag
::A
;
21 test_1
::<CompileFlag
::A
>();
22 //~^ ERROR: expected type, found variant
23 //~| ERROR: unresolved item provided when a constant was expected
25 test_2
::<_
, CompileFlag
::A
>(0);
26 //~^ ERROR: expected type, found variant
27 //~| ERROR: unresolved item provided when a constant was expected
29 let _
: Example
<CompileFlag
::A
, _
> = Example { x: 0 }
;
30 //~^ ERROR: expected type, found variant
31 //~| ERROR: unresolved item provided when a constant was expected
33 let _
: Example
<Example
::ASSOC_FLAG
, _
> = Example { x: 0 }
;
34 //~^ ERROR: type provided when a constant was expected