2019-09-28 15:07:22 +12:00
|
|
|
#![feature(const_generics)]
|
2020-08-09 05:01:19 +00:00
|
|
|
#![allow(incomplete_features)]
|
2019-09-28 15:07:22 +12:00
|
|
|
|
|
|
|
struct ConstString<const T: &'static str>;
|
|
|
|
struct ConstBytes<const T: &'static [u8]>;
|
|
|
|
|
|
|
|
pub fn main() {
|
2019-09-29 08:39:48 +13:00
|
|
|
let _: ConstString<"Hello"> = ConstString::<"Hello">;
|
2019-09-28 15:07:22 +12:00
|
|
|
let _: ConstString<"Hello"> = ConstString::<"World">; //~ ERROR mismatched types
|
2019-09-29 08:39:48 +13:00
|
|
|
let _: ConstString<"ℇ㇈↦"> = ConstString::<"ℇ㇈↦">;
|
|
|
|
let _: ConstString<"ℇ㇈↦"> = ConstString::<"ℇ㇈↥">; //~ ERROR mismatched types
|
2019-09-28 15:07:22 +12:00
|
|
|
let _: ConstBytes<b"AAA"> = ConstBytes::<{&[0x41, 0x41, 0x41]}>;
|
|
|
|
let _: ConstBytes<b"AAA"> = ConstBytes::<b"BBB">; //~ ERROR mismatched types
|
|
|
|
}
|