librustc: Stop trying to make invalid slice with vec in static.
Add test for #5917.
auto merge of #8078 : luqmana/rust/gst, r=Aatch

Fixes #5917 by not trying to treat `&[T]` as a slice since it already is one.