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