Remove #[legacy_modes]

This is for issue #4710.