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:
parent
7654d4b398
commit
a081007265
2 changed files with 18 additions and 15 deletions
|
@ -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)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue