]> git.lizzy.rs Git - rust.git/blob - src/test/ui/const-generics/slice-const-param-mismatch.rs
Rollup merge of #74141 - euclio:typos, r=steveklabnik
[rust.git] / src / test / ui / const-generics / slice-const-param-mismatch.rs
1 #![feature(const_generics)]
2 //~^ WARN the feature `const_generics` is incomplete
3
4 struct ConstString<const T: &'static str>;
5 struct ConstBytes<const T: &'static [u8]>;
6
7 pub fn main() {
8     let _: ConstString<"Hello"> = ConstString::<"Hello">;
9     let _: ConstString<"Hello"> = ConstString::<"World">; //~ ERROR mismatched types
10     let _: ConstString<"ℇ㇈↦"> = ConstString::<"ℇ㇈↦">;
11     let _: ConstString<"ℇ㇈↦"> = ConstString::<"ℇ㇈↥">; //~ ERROR mismatched types
12     let _: ConstBytes<b"AAA"> = ConstBytes::<{&[0x41, 0x41, 0x41]}>;
13     let _: ConstBytes<b"AAA"> = ConstBytes::<b"BBB">; //~ ERROR mismatched types
14 }