@@ -1517,15 +1517,19 @@ where
15171517 continue ;
15181518 }
15191519
1520- // CARGO_MAKEFLAGS will have jobserver info which is extremely non-cacheable.
1521- // CARGO_REGISTRIES_*_TOKEN contains non-cacheable secrets.
1522- // Registry override config doesn't need to be hashed, because deps' package IDs
1523- // already uniquely identify the relevant registries.
1524- // CARGO_BUILD_JOBS only affects Cargo's parallelism, not rustc output.
1525- if var == "CARGO_MAKEFLAGS"
1526- || var. starts_with ( "CARGO_REGISTRIES_" )
1527- || var == "CARGO_BUILD_JOBS"
1528- {
1520+ let may_skip = var == "CARGO_MAKEFLAGS" // will have jobserver info which is extremely non-cacheable.
1521+ || var == "CARGO_BUILD_JOBS" // does not affect results
1522+ || var. starts_with ( "CARGO_REGISTRIES_" ) // CARGO_REGISTRIES_*_TOKEN contains non-cacheable secrets, and package IDs already uniquely identify the relevant registries.
1523+ || var. starts_with ( "CARGO_REGISTRY_" ) // same as CARGO_REGISTRIES_*
1524+ || var == "CARGO_TARGET_DIR" // already included in the file paths
1525+ || var == "CARGO_BUILD_BUILD_DIR"
1526+ || var == "CARGO_BUILD_TARGET_DIR"
1527+ || var. starts_with ( "CARGO_HTTP_" ) // not relevant
1528+ || var. starts_with ( "CARGO_NET_" )
1529+ || var. starts_with ( "CARGO_TERM_" )
1530+ || var. starts_with ( "CARGO_ALIAS_" )
1531+ || var == "CARGO_CACHE_AUTO_CLEAN_FREQUENCY" ;
1532+ if may_skip {
15291533 continue ;
15301534 }
15311535
@@ -3501,6 +3505,7 @@ proc_macro false
35013505 OsString :: from ( "CARGO_BUILD_JOBS" ) ,
35023506 OsString :: from ( "ignored" ) ,
35033507 ) ,
3508+ ( OsString :: from ( "CARGO_TERM_COLOR" ) , OsString :: from ( "never" ) ) ,
35043509 ]
35053510 . to_vec ( ) ,
35063511 false ,
0 commit comments