]> git.lizzy.rs Git - rust.git/blob - src/test/ui/const-generics/slice-const-param-mismatch.rs
Merge commit '5034d47f721ff4c3a3ff2aca9ef2ef3e1d067f9f' into clippyup
[rust.git] / src / test / ui / const-generics / slice-const-param-mismatch.rs
1 // revisions: full min
2
3 #![cfg_attr(full, feature(const_generics))]
4 #![cfg_attr(full, allow(incomplete_features))]
5 #![cfg_attr(min, feature(min_const_generics))]
6
7
8 struct ConstString<const T: &'static str>;
9 //[min]~^ ERROR
10 struct ConstBytes<const T: &'static [u8]>;
11 //[min]~^ ERROR
12
13 pub fn main() {
14     let _: ConstString<"Hello"> = ConstString::<"Hello">;
15     let _: ConstString<"Hello"> = ConstString::<"World">; //[full]~ ERROR mismatched types
16     let _: ConstString<"ℇ㇈↦"> = ConstString::<"ℇ㇈↦">;
17     let _: ConstString<"ℇ㇈↦"> = ConstString::<"ℇ㇈↥">; //[full]~ ERROR mismatched types
18     let _: ConstBytes<b"AAA"> = ConstBytes::<{&[0x41, 0x41, 0x41]}>;
19     let _: ConstBytes<b"AAA"> = ConstBytes::<b"BBB">; //[full]~ ERROR mismatched types
20 }