Forbid use of generics with foreign functions. Closes #10353.
auto merge of #12337 : nick29581/rust/generic_extern, r=alexcrichton

and fix up some formatting.