changed the ensures clause of swap_first_entry