]> git.lizzy.rs Git - rust.git/blob - src/test/ui/const-generics/slice-const-param.rs
Move generic error message to separate branches
[rust.git] / src / test / ui / const-generics / slice-const-param.rs
1 // run-pass
2
3 #![feature(adt_const_params)]
4 #![allow(incomplete_features)]
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 }