To learn more about how dependency tracking works in rustc, see the rustc dev guide.