]> git.lizzy.rs Git - rust.git/blob - src/test/ui/const-generics/slice-const-param.rs
Auto merge of #74017 - poliorcetics:where-keyword, r=jyn514
[rust.git] / src / test / ui / const-generics / slice-const-param.rs
1 // run-pass
2
3 #![feature(const_generics)]
4 //~^ WARN the feature `const_generics` is incomplete
5
6 pub fn function_with_str<const STRING: &'static str>() -> &'static str {
7     STRING
8 }
9
10 pub fn function_with_bytes<const BYTES: &'static [u8]>() -> &'static [u8] {
11     BYTES
12 }
13
14 pub fn main() {
15     assert_eq!(function_with_str::<"Rust">(), "Rust");
16     assert_eq!(function_with_str::<"ℇ㇈↦">(), "ℇ㇈↦");
17     assert_eq!(function_with_bytes::<b"AAAA">(), &[0x41, 0x41, 0x41, 0x41]);
18     assert_eq!(function_with_bytes::<{&[0x41, 0x41, 0x41, 0x41]}>(), b"AAAA");
19 }