no - not at all!
one's a late shift and one's an early - quite common and you can expect quite a selection of these shifts.
Why do you think it would be illegal?
"An adult worker is entitled to a rest period of not less than eleven consecutive hours in each 24-hour period during which he works for his employer."