Constraints on dark matter models from a Fermi LAT search for high-energy cosmic-ray electrons from the Sun