Module rustc_session::config::dep_tracking

source ·
Expand description

Command-line arguments passed to the compiler have to be incorporated with the dependency tracking system for incremental compilation. This module provides some utilities to make this more convenient.

The values of all command-line arguments that are relevant for dependency tracking are hashed into a single value that determines whether the incremental compilation cache can be re-used or not. This hashing is done via the DepTrackingHash trait defined below, since the standard Hash implementation might not be suitable (e.g., arguments are stored in a Vec, the hash of which is order dependent, but we might not want the order of arguments to make a difference for the hash).

However, since the value provided by Hash::hash often is suitable, especially for primitive types, there is the impl_dep_tracking_hash_via_hash!() macro that allows to simply reuse the Hash implementation for DepTrackingHash. It’s important though that we have an opt-in scheme here, so one is hopefully forced to think about how the hash should be calculated when adding a new command-line argument.