2024-07-14 12:38:51 +00:00
|
|
|
//@ revisions: min adt_const_params full
|
2020-08-10 18:50:58 +00:00
|
|
|
|
2024-07-14 12:38:51 +00:00
|
|
|
#![cfg_attr(full, feature(adt_const_params, unsized_const_params))]
|
2020-08-10 18:50:58 +00:00
|
|
|
#![cfg_attr(full, allow(incomplete_features))]
|
2024-07-14 12:38:51 +00:00
|
|
|
#![cfg_attr(adt_const_params, feature(adt_const_params))]
|
|
|
|
#![cfg_attr(adt_const_params, allow(incomplete_features))]
|
2019-09-28 03:07:22 +00:00
|
|
|
|
|
|
|
struct ConstString<const T: &'static str>;
|
2020-08-10 18:50:58 +00:00
|
|
|
//[min]~^ ERROR
|
2024-07-14 12:38:51 +00:00
|
|
|
//[adt_const_params]~^^ ERROR
|
2019-09-28 03:07:22 +00:00
|
|
|
struct ConstBytes<const T: &'static [u8]>;
|
2020-08-10 18:50:58 +00:00
|
|
|
//[min]~^ ERROR
|
2024-07-14 12:38:51 +00:00
|
|
|
//[adt_const_params]~^^ ERROR
|
2019-09-28 03:07:22 +00:00
|
|
|
|
|
|
|
pub fn main() {
|
2019-09-28 19:39:48 +00:00
|
|
|
let _: ConstString<"Hello"> = ConstString::<"Hello">;
|
2024-02-09 12:17:55 +00:00
|
|
|
let _: ConstString<"Hello"> = ConstString::<"World">; //~ ERROR mismatched types
|
2019-09-28 19:39:48 +00:00
|
|
|
let _: ConstString<"ℇ㇈↦"> = ConstString::<"ℇ㇈↦">;
|
2024-02-09 12:17:55 +00:00
|
|
|
let _: ConstString<"ℇ㇈↦"> = ConstString::<"ℇ㇈↥">; //~ ERROR mismatched types
|
2024-07-14 12:38:51 +00:00
|
|
|
let _: ConstBytes<b"AAA"> = ConstBytes::<{ &[0x41, 0x41, 0x41] }>;
|
2024-02-09 12:17:55 +00:00
|
|
|
let _: ConstBytes<b"AAA"> = ConstBytes::<b"BBB">; //~ ERROR mismatched types
|
2019-09-28 03:07:22 +00:00
|
|
|
}
|