@@ -418,23 +418,13 @@ where
418
418
Ok ( ret_tokens)
419
419
}
420
420
421
- #[ cfg( procmacro2_semver_exempt) ]
422
- static TRACKED_ENV_VARS : Mutex < HashSet < String , BuildHasherDefault < DefaultHasher > > > =
423
- Mutex :: new ( HashSet :: with_hasher ( BuildHasherDefault :: new ( ) ) ) ;
424
-
425
421
static LOADED_ENV_VARS : Mutex < HashMap < String , String , BuildHasherDefault < DefaultHasher > > > =
426
422
Mutex :: new ( HashMap :: with_hasher ( BuildHasherDefault :: new ( ) ) ) ;
427
423
428
424
/// Get the value of an environment variable, telling the compiler about it if applicable.
429
425
fn env ( name : & str ) -> Result < String , std:: env:: VarError > {
430
426
#[ cfg( procmacro2_semver_exempt) ]
431
- let tracked_value = if TRACKED_ENV_VARS . lock ( ) . unwrap ( ) . insert ( name. to_string ( ) ) {
432
- // Avoid tracking the same env var multiple times, which would undesirably modify
433
- // build system state and thus behavior in case we change var values.
434
- Some ( proc_macro:: tracked_env:: var ( name) )
435
- } else {
436
- None
437
- } ;
427
+ let tracked_value = Some ( proc_macro:: tracked_env:: var ( name) ) ;
438
428
#[ cfg( not( procmacro2_semver_exempt) ) ]
439
429
let tracked_value = None ;
440
430
@@ -473,17 +463,6 @@ fn load_env(manifest_dir: &Path, config: &Config) {
473
463
}
474
464
}
475
465
476
- // Tell the compiler about the environment variables we care about before we load them
477
- // from any `.env`, so the build system can react to changes in their original values,
478
- // not the values we load from a potential `.env` file tracked above, which should not
479
- // take precedence.
480
- #[ cfg( procmacro2_semver_exempt) ]
481
- for name in & loadable_vars {
482
- if TRACKED_ENV_VARS . lock ( ) . unwrap ( ) . insert ( name. to_string ( ) ) {
483
- proc_macro:: tracked_env:: var ( name) ;
484
- }
485
- }
486
-
487
466
if let Some ( dotenv_path) = found_dotenv
488
467
. then_some ( candidate_dotenv_paths)
489
468
. iter ( )
0 commit comments