Implement cross-crate support for autoderef.
Closes #13044.