The U.S. Navy has shelved its ambitious electromagnetic railgun, citing cost, technical risk, and brutal rail-wear issues.