Fix ICE when calling static and static function pointers

Fixes #8588
Add assertions and cross crate tests
Split cross-crate test into own test and xfail-fast it
Changed `fn main` to `pub fn main`
auto merge of #8594 : bytewiseand/rust/static-fn-ptr, r=pcwalton

Fixes #8588