Skip to content

Commit d767ef7

Browse files
Fix duplicated path in the "not found dylib" error
1 parent f04c5c5 commit d767ef7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

compiler/rustc_metadata/src/creader.rs

+6
Original file line numberDiff line numberDiff line change
@@ -1132,6 +1132,12 @@ fn load_dylib(path: &Path, max_attempts: usize) -> Result<libloading::Library, S
11321132
Err(err) => {
11331133
// Only try to recover from this specific error.
11341134
if !matches!(err, libloading::Error::LoadLibraryExW { .. }) {
1135+
let err = format_dlopen_err(&err);
1136+
// We include the path of the dylib in the error ourselves, so
1137+
// if it's in the error, we strip it.
1138+
if let Some(err) = err.strip_prefix(&format!(": {}", path.display())) {
1139+
return Err(err.to_string());
1140+
}
11351141
return Err(err.to_string());
11361142
}
11371143

0 commit comments

Comments
 (0)