Allow generic foreign functions.

This allows for things like this:

    extern "C" fn callback<T>(t: T) { /* ... */ }
    extern "C" {
        fn take_callback(c: extern fn(i32));
    }

and later:

    take_callback(callback::<i32>);

Closes #12502.
This doesn't seem to be used from `test.rs`, could you be sure to use it and the struct?