Skip to content

Commit e0e4a33

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

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

compiler/rustc_metadata/src/creader.rs

Lines changed: 6 additions & 0 deletions
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 = err.to_string();
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(&path.display().to_string()) {
1139+
return Err(err.to_string());
1140+
}
11351141
return Err(err.to_string());
11361142
}
11371143

0 commit comments

Comments
 (0)