File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed 
src/doc/unstable-book/src/compiler-flags Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 1+ # ` env `  
2+ 
3+ The tracking issue for this feature is: [ #118372  ] ( https://github.com/rust-lang/rust/issues/118372 ) .
4+ 
5+ ------------------------ 
6+ 
7+ This option flag allows to specify environment variables value at compile time to be
8+ used by ` env! `  and ` option_env! `  macros.
9+ 
10+ When retrieving an environment variable value, the one specified by ` --env `  will take
11+ precedence. For example, if you want have ` PATH=a `  in your environment and pass:
12+ 
13+ ``` bash 
14+ rustc --env PATH=env
15+ ``` 
16+ 
17+ Then you will have:
18+ 
19+ ``` rust,no_run 
20+ assert_eq!(env!("PATH"), "env"); 
21+ ``` 
22+ 
23+ Please note that on Windows, environment variables are case insensitive but case
24+ preserving whereas ` rustc ` 's environment variables are case sensitive. For example,
25+ having ` Path `  in your environment (case insensitive) is different than using
26+ ` rustc --env Path=... `  (case sensitive).
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments