2020-08-09 05:01:19 +00:00
|
|
|
//[full] run-pass
|
|
|
|
// revisions: min full
|
2019-09-27 19:43:46 +12:00
|
|
|
|
2020-08-09 05:01:19 +00:00
|
|
|
#![cfg_attr(full, feature(const_generics))]
|
|
|
|
#![cfg_attr(full, allow(incomplete_features))]
|
2019-09-27 19:43:46 +12:00
|
|
|
|
|
|
|
pub fn function_with_str<const STRING: &'static str>() -> &'static str {
|
2020-08-18 22:44:06 +02:00
|
|
|
//[min]~^ ERROR `&'static str` is forbidden
|
2019-09-27 19:43:46 +12:00
|
|
|
STRING
|
|
|
|
}
|
|
|
|
|
2019-09-28 15:07:22 +12:00
|
|
|
pub fn function_with_bytes<const BYTES: &'static [u8]>() -> &'static [u8] {
|
2020-08-18 22:44:06 +02:00
|
|
|
//[min]~^ ERROR `&'static [u8]` is forbidden
|
2019-09-28 15:07:22 +12:00
|
|
|
BYTES
|
|
|
|
}
|
|
|
|
|
2019-09-27 19:43:46 +12:00
|
|
|
pub fn main() {
|
|
|
|
assert_eq!(function_with_str::<"Rust">(), "Rust");
|
2019-09-29 08:39:48 +13:00
|
|
|
assert_eq!(function_with_str::<"ℇ㇈↦">(), "ℇ㇈↦");
|
2019-09-28 15:07:22 +12:00
|
|
|
assert_eq!(function_with_bytes::<b"AAAA">(), &[0x41, 0x41, 0x41, 0x41]);
|
|
|
|
assert_eq!(function_with_bytes::<{&[0x41, 0x41, 0x41, 0x41]}>(), b"AAAA");
|
2019-09-27 19:43:46 +12:00
|
|
|
}
|