]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-eval/issue-84957-const-str-as-bytes.rs
Merge commit '7b73b60faca71d01d900e49831fcb84553e93019' into sync-rustfmt
[rust.git] / src / test / ui / consts / const-eval / issue-84957-const-str-as-bytes.rs
1 // build-pass
2
3 trait Foo {}
4
5 struct Bar {
6     bytes: &'static [u8],
7     func: fn(&Box<dyn Foo>),
8 }
9 fn example(_: &Box<dyn Foo>) {}
10
11 const BARS: &[Bar] = &[
12     Bar {
13         bytes: "0".as_bytes(),
14         func: example,
15     },
16     Bar {
17         bytes: "0".as_bytes(),
18         func: example,
19     },
20 ];
21
22 fn main() {
23     let x = todo!();
24
25     for bar in BARS {
26         (bar.func)(&x);
27     }
28 }