1
Fork 0

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.
This commit is contained in:
Tamir Duberstein 2023-10-06 08:22:35 -04:00
parent 7654d4b398
commit a081007265
No known key found for this signature in database
2 changed files with 18 additions and 15 deletions

View file

@ -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)]