]> git.lizzy.rs Git - rust.git/blob - src/test/ui/const-generics/types-mismatch-const-args.rs
Auto merge of #79342 - CDirkx:ipaddr-const, r=oli-obk
[rust.git] / src / test / ui / const-generics / types-mismatch-const-args.rs
1 // revisions: full min
2 #![cfg_attr(full, feature(const_generics))]
3 #![cfg_attr(full, allow(incomplete_features))]
4 #![cfg_attr(min, feature(min_const_generics))]
5
6 // tests the diagnostic output of type mismatches for types that have const generics arguments.
7
8 use std::marker::PhantomData;
9
10 struct A<'a, T, const X: u32, const Y: u32> {
11     data: PhantomData<&'a T>
12 }
13
14 fn a<'a, 'b>() {
15     let _: A<'a, u32, {2u32}, {3u32}> = A::<'a, u32, {4u32}, {3u32}> { data: PhantomData };
16     //~^ ERROR mismatched types
17     let _: A<'a, u16, {2u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData };
18     //~^ ERROR mismatched types
19 }
20
21 pub fn main() {}