Sync with trunk (r47116), hopefully without breaking anything.