17
17
//! Cargo begins a normal `cargo check` operation with itself set as a proxy
18
18
//! for rustc by setting `primary_unit_rustc` in the build config. When
19
19
//! cargo launches rustc to check a crate, it is actually launching itself.
20
- //! The `FIX_ENV ` environment variable is set so that cargo knows it is in
20
+ //! The `FIX_ENV_INTERNAL ` environment variable is set so that cargo knows it is in
21
21
//! fix-proxy-mode.
22
22
//!
23
- //! Each proxied cargo-as-rustc detects it is in fix-proxy-mode (via `FIX_ENV `
23
+ //! Each proxied cargo-as-rustc detects it is in fix-proxy-mode (via `FIX_ENV_INTERNAL `
24
24
//! environment variable in `main`) and does the following:
25
25
//!
26
26
//! - Acquire a lock from the `LockServer` from the master cargo process.
@@ -67,16 +67,16 @@ use crate::{drop_eprint, drop_eprintln};
67
67
/// Indicates Cargo is in fix-proxy-mode if presents.
68
68
/// The value of it is the socket address of the [`LockServer`] being used.
69
69
/// See the [module-level documentation](mod@super::fix) for more.
70
- const FIX_ENV : & str = "__CARGO_FIX_PLZ" ;
70
+ const FIX_ENV_INTERNAL : & str = "__CARGO_FIX_PLZ" ;
71
71
/// **Internal only.**
72
72
/// For passing [`FixOptions::broken_code`] through to cargo running in proxy mode.
73
- const BROKEN_CODE_ENV : & str = "__CARGO_FIX_BROKEN_CODE" ;
73
+ const BROKEN_CODE_ENV_INTERNAL : & str = "__CARGO_FIX_BROKEN_CODE" ;
74
74
/// **Internal only.**
75
75
/// For passing [`FixOptions::edition`] through to cargo running in proxy mode.
76
- const EDITION_ENV : & str = "__CARGO_FIX_EDITION" ;
76
+ const EDITION_ENV_INTERNAL : & str = "__CARGO_FIX_EDITION" ;
77
77
/// **Internal only.**
78
78
/// For passing [`FixOptions::idioms`] through to cargo running in proxy mode.
79
- const IDIOMS_ENV : & str = "__CARGO_FIX_IDIOMS" ;
79
+ const IDIOMS_ENV_INTERNAL : & str = "__CARGO_FIX_IDIOMS" ;
80
80
81
81
pub struct FixOptions {
82
82
pub edition : bool ,
@@ -97,20 +97,20 @@ pub fn fix(ws: &Workspace<'_>, opts: &mut FixOptions) -> CargoResult<()> {
97
97
// Spin up our lock server, which our subprocesses will use to synchronize fixes.
98
98
let lock_server = LockServer :: new ( ) ?;
99
99
let mut wrapper = ProcessBuilder :: new ( env:: current_exe ( ) ?) ;
100
- wrapper. env ( FIX_ENV , lock_server. addr ( ) . to_string ( ) ) ;
100
+ wrapper. env ( FIX_ENV_INTERNAL , lock_server. addr ( ) . to_string ( ) ) ;
101
101
let _started = lock_server. start ( ) ?;
102
102
103
103
opts. compile_opts . build_config . force_rebuild = true ;
104
104
105
105
if opts. broken_code {
106
- wrapper. env ( BROKEN_CODE_ENV , "1" ) ;
106
+ wrapper. env ( BROKEN_CODE_ENV_INTERNAL , "1" ) ;
107
107
}
108
108
109
109
if opts. edition {
110
- wrapper. env ( EDITION_ENV , "1" ) ;
110
+ wrapper. env ( EDITION_ENV_INTERNAL , "1" ) ;
111
111
}
112
112
if opts. idioms {
113
- wrapper. env ( IDIOMS_ENV , "1" ) ;
113
+ wrapper. env ( IDIOMS_ENV_INTERNAL , "1" ) ;
114
114
}
115
115
116
116
* opts
@@ -352,7 +352,7 @@ pub fn fix_get_proxy_lock_addr() -> Option<String> {
352
352
// ALLOWED: For the internal mechanism of `cargo fix` only.
353
353
// Shouldn't be set directly by anyone.
354
354
#[ allow( clippy:: disallowed_methods) ]
355
- env:: var ( FIX_ENV ) . ok ( )
355
+ env:: var ( FIX_ENV_INTERNAL ) . ok ( )
356
356
}
357
357
358
358
/// Entry point for `cargo` running as a proxy for `rustc`.
@@ -373,7 +373,7 @@ pub fn fix_exec_rustc(config: &Config, lock_addr: &str) -> CargoResult<()> {
373
373
. ok ( ) ;
374
374
let mut rustc = ProcessBuilder :: new ( & args. rustc ) . wrapped ( workspace_rustc. as_ref ( ) ) ;
375
375
rustc. retry_with_argfile ( true ) ;
376
- rustc. env_remove ( FIX_ENV ) ;
376
+ rustc. env_remove ( FIX_ENV_INTERNAL ) ;
377
377
args. apply ( & mut rustc) ;
378
378
379
379
trace ! ( "start rustfixing {:?}" , args. file) ;
@@ -417,7 +417,7 @@ pub fn fix_exec_rustc(config: &Config, lock_addr: &str) -> CargoResult<()> {
417
417
// user's code with our changes. Back out everything and fall through
418
418
// below to recompile again.
419
419
if !output. status . success ( ) {
420
- if config. get_env_os ( BROKEN_CODE_ENV ) . is_none ( ) {
420
+ if config. get_env_os ( BROKEN_CODE_ENV_INTERNAL ) . is_none ( ) {
421
421
for ( path, file) in fixes. files . iter ( ) {
422
422
debug ! ( "reverting {:?} due to errors" , path) ;
423
423
paths:: write ( path, & file. original_code ) ?;
@@ -591,7 +591,7 @@ fn rustfix_and_fix(
591
591
// worse by applying fixes where a bug could cause *more* broken code.
592
592
// Instead, punt upwards which will reexec rustc over the original code,
593
593
// displaying pretty versions of the diagnostics we just read out.
594
- if !output. status . success ( ) && config. get_env_os ( BROKEN_CODE_ENV ) . is_none ( ) {
594
+ if !output. status . success ( ) && config. get_env_os ( BROKEN_CODE_ENV_INTERNAL ) . is_none ( ) {
595
595
debug ! (
596
596
"rustfixing `{:?}` failed, rustc exited with {:?}" ,
597
597
filename,
@@ -863,12 +863,12 @@ impl FixArgs {
863
863
// ALLOWED: For the internal mechanism of `cargo fix` only.
864
864
// Shouldn't be set directly by anyone.
865
865
#[ allow( clippy:: disallowed_methods) ]
866
- let idioms = env:: var ( IDIOMS_ENV ) . is_ok ( ) ;
866
+ let idioms = env:: var ( IDIOMS_ENV_INTERNAL ) . is_ok ( ) ;
867
867
868
868
// ALLOWED: For the internal mechanism of `cargo fix` only.
869
869
// Shouldn't be set directly by anyone.
870
870
#[ allow( clippy:: disallowed_methods) ]
871
- let prepare_for_edition = env:: var ( EDITION_ENV ) . ok ( ) . map ( |_| {
871
+ let prepare_for_edition = env:: var ( EDITION_ENV_INTERNAL ) . ok ( ) . map ( |_| {
872
872
enabled_edition
873
873
. unwrap_or ( Edition :: Edition2015 )
874
874
. saturating_next ( )
0 commit comments