diff options
| author | Tamir Duberstein <tamird@gmail.com> | 2023-10-06 08:22:35 -0400 |
|---|---|---|
| committer | Tamir Duberstein <tamird@gmail.com> | 2023-10-06 08:54:14 -0400 |
| commit | a081007265044a7baa0f23c286b6380be35c8bb0 (patch) | |
| tree | aa73a87e34071378e5f04e2c705077f711b1de84 /compiler/rustc_driver_impl/src/session_diagnostics.rs | |
| parent | 7654d4b39833bc6fc0b0bcd184a616ff6ac7d9bd (diff) | |
| download | rust-a081007265044a7baa0f23c286b6380be35c8bb0.tar.gz rust-a081007265044a7baa0f23c286b6380be35c8bb0.zip | |
rustc_driver: avoid fallible conversions
Use `std::path::PathBuf` rather than `String`; use `std::env::var_os` rather than `std::env::var`. These changes avoid a number of error paths which can arise in the presence of non-UTF-8 paths.
Diffstat (limited to 'compiler/rustc_driver_impl/src/session_diagnostics.rs')
| -rw-r--r-- | compiler/rustc_driver_impl/src/session_diagnostics.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_driver_impl/src/session_diagnostics.rs b/compiler/rustc_driver_impl/src/session_diagnostics.rs index 5eb587c54d9..442989f8de8 100644 --- a/compiler/rustc_driver_impl/src/session_diagnostics.rs +++ b/compiler/rustc_driver_impl/src/session_diagnostics.rs @@ -52,13 +52,13 @@ pub(crate) struct IceVersion<'a> { #[derive(Diagnostic)] #[diag(driver_impl_ice_path)] pub(crate) struct IcePath { - pub path: String, + pub path: std::path::PathBuf, } #[derive(Diagnostic)] #[diag(driver_impl_ice_path_error)] pub(crate) struct IcePathError { - pub path: String, + pub path: std::path::PathBuf, pub error: String, #[subdiagnostic] pub env_var: Option<IcePathErrorEnv>, @@ -67,7 +67,7 @@ pub(crate) struct IcePathError { #[derive(Subdiagnostic)] #[note(driver_impl_ice_path_error_env)] pub(crate) struct IcePathErrorEnv { - pub env_var: String, + pub env_var: std::path::PathBuf, } #[derive(Diagnostic)] |
