Extracted from #14647.
Extracted from #14647.