add test for issue 84957

This commit is contained in:
cameron 2021-10-18 08:41:18 +01:00
parent e1e9319d93
commit f8b2f91c48

View File

@ -0,0 +1,28 @@
// 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);
}
}