diff options
| author | Sameer Puri <sameer@dropbox.com> | 2023-04-28 09:53:09 +0200 |
|---|---|---|
| committer | Sameer Puri <sameer@dropbox.com> | 2023-04-28 17:32:46 +0200 |
| commit | 24adb1f68cb5ce7fae8cb9a4b01aab728d827fa2 (patch) | |
| tree | 66b9355e323f0b092c896a6d2ff097341457c046 /compiler/rustc_metadata | |
| parent | 033aa092ab23ba14cdad27073c5e37ba0eddb428 (diff) | |
| download | rust-24adb1f68cb5ce7fae8cb9a4b01aab728d827fa2.tar.gz rust-24adb1f68cb5ce7fae8cb9a4b01aab728d827fa2.zip | |
include source error for LoadLibraryExW
Diffstat (limited to 'compiler/rustc_metadata')
| -rw-r--r-- | compiler/rustc_metadata/src/creader.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler/rustc_metadata/src/creader.rs b/compiler/rustc_metadata/src/creader.rs index 179453238f2..01b69966ca9 100644 --- a/compiler/rustc_metadata/src/creader.rs +++ b/compiler/rustc_metadata/src/creader.rs @@ -27,6 +27,7 @@ use rustc_span::{Span, DUMMY_SP}; use rustc_target::spec::{PanicStrategy, TargetTriple}; use proc_macro::bridge::client::ProcMacro; +use std::error::Error; use std::ops::Fn; use std::path::Path; use std::time::Duration; @@ -1094,5 +1095,12 @@ fn load_dylib(path: &Path, max_attempts: usize) -> Result<libloading::Library, S } debug!("Failed to load proc-macro `{}` even after {} attempts.", path.display(), max_attempts); - Err(format!("{} (retried {} times)", last_error.unwrap(), max_attempts)) + + let last_error = last_error.unwrap(); + let message = if let Some(src) = last_error.source() { + format!("{last_error} ({src}) (retried {max_attempts} times)") + } else { + format!("{last_error} (retried {max_attempts} times)") + }; + Err(message) } |
