]> git.lizzy.rs Git - rust.git/blob - tests/run-make-fulldeps/pgo-indirect-call-promotion/main.rs
Rollup merge of #106605 - notriddle:notriddle/outdated-rustbook, r=GuillaumeGomez
[rust.git] / tests / run-make-fulldeps / pgo-indirect-call-promotion / main.rs
1 extern crate interesting;
2
3 fn main() {
4     // function pointer case
5     let fns: Vec<_> = std::iter::repeat(interesting::function_called_always as fn())
6         .take(1000)
7         .collect();
8     interesting::call_a_bunch_of_functions(&fns[..]);
9
10     // Trait object case
11     let trait_objects = vec![0u32; 1000];
12     let trait_objects: Vec<_> = trait_objects.iter().map(|x| x as &dyn interesting::Foo).collect();
13     interesting::call_a_bunch_of_trait_methods(&trait_objects[..]);
14 }