Skip to content
/ rust Public
forked from rust-lang/rust

Commit

Permalink
Fix duplicated path in the "not found dylib" error
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Mar 4, 2024
1 parent f04c5c5 commit 640e99c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion compiler/rustc_metadata/src/creader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,13 @@ fn load_dylib(path: &Path, max_attempts: usize) -> Result<libloading::Library, S
Err(err) => {
// Only try to recover from this specific error.
if !matches!(err, libloading::Error::LoadLibraryExW { .. }) {
return Err(err.to_string());
let err = format_dlopen_err(&err);
// We include the path of the dylib in the error ourselves, so
// if it's in the error, we strip it.
if let Some(err) = err.strip_prefix(&format!(": {}", path.display())) {
return Err(err.to_string());
}
return Err(err);
}

last_error = Some(err);
Expand Down

0 comments on commit 640e99c

Please sign in to comment.