mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-02 07:22:42 +00:00
29 lines
391 B
Rust
29 lines
391 B
Rust
//@ build-pass
|
|
|
|
trait Foo {}
|
|
|
|
struct Bar {
|
|
bytes: &'static [u8],
|
|
func: fn(&Box<dyn Foo>),
|
|
}
|
|
fn example(_: &Box<dyn Foo>) {}
|
|
|
|
const BARS: &[Bar] = &[
|
|
Bar {
|
|
bytes: "0".as_bytes(),
|
|
func: example,
|
|
},
|
|
Bar {
|
|
bytes: "0".as_bytes(),
|
|
func: example,
|
|
},
|
|
];
|
|
|
|
fn main() {
|
|
let x = todo!();
|
|
|
|
for bar in BARS {
|
|
(bar.func)(&x);
|
|
}
|
|
}
|