mirror of
				https://github.com/rust-lang/rust-analyzer.git
				synced 2025-10-30 19:49:36 +00:00 
			
		
		
		
	Switch back to RUST_SRC_PATH
This commit is contained in:
		
							parent
							
								
									88fbdcd510
								
							
						
					
					
						commit
						a7547a473b
					
				
					 1 changed files with 6 additions and 8 deletions
				
			
		|  | @ -312,8 +312,8 @@ impl Sysroot { | ||||||
|                     RustLibSrcWorkspace::Empty => true, |                     RustLibSrcWorkspace::Empty => true, | ||||||
|                 }; |                 }; | ||||||
|                 if !has_core { |                 if !has_core { | ||||||
|                     let var_note = if env::var_os("rust_lib_src_PATH").is_some() { |                     let var_note = if env::var_os("RUST_SRC_PATH").is_some() { | ||||||
|                         " (env var `rust_lib_src_PATH` is set and may be incorrect, try unsetting it)" |                         " (env var `RUST_SRC_PATH` is set and may be incorrect, try unsetting it)" | ||||||
|                     } else { |                     } else { | ||||||
|                         ", try running `rustup component add rust-src` to possibly fix this" |                         ", try running `rustup component add rust-src` to possibly fix this" | ||||||
|                     }; |                     }; | ||||||
|  | @ -422,18 +422,16 @@ fn discover_sysroot_dir( | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| fn discover_rust_lib_src_dir(sysroot_path: &AbsPathBuf) -> Option<AbsPathBuf> { | fn discover_rust_lib_src_dir(sysroot_path: &AbsPathBuf) -> Option<AbsPathBuf> { | ||||||
|     if let Ok(path) = env::var("rust_lib_src_PATH") { |     if let Ok(path) = env::var("RUST_SRC_PATH") { | ||||||
|         if let Ok(path) = AbsPathBuf::try_from(path.as_str()) { |         if let Ok(path) = AbsPathBuf::try_from(path.as_str()) { | ||||||
|             let core = path.join("core"); |             let core = path.join("core"); | ||||||
|             if fs::metadata(&core).is_ok() { |             if fs::metadata(&core).is_ok() { | ||||||
|                 tracing::debug!("Discovered sysroot by rust_lib_src_PATH: {path}"); |                 tracing::debug!("Discovered sysroot by RUST_SRC_PATH: {path}"); | ||||||
|                 return Some(path); |                 return Some(path); | ||||||
|             } |             } | ||||||
|             tracing::debug!( |             tracing::debug!("RUST_SRC_PATH is set, but is invalid (no core: {core:?}), ignoring"); | ||||||
|                 "rust_lib_src_PATH is set, but is invalid (no core: {core:?}), ignoring" |  | ||||||
|             ); |  | ||||||
|         } else { |         } else { | ||||||
|             tracing::debug!("rust_lib_src_PATH is set, but is invalid, ignoring"); |             tracing::debug!("RUST_SRC_PATH is set, but is invalid, ignoring"); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Laurențiu Nicola
						Laurențiu Nicola