diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2023-04-29 11:27:55 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-29 11:27:55 +0530 |
| commit | 650f8fddd9ba3eb2127879a7aed04bbeb4b8045d (patch) | |
| tree | fa5ed7026642dd42d2a78756638c39293cbbfab5 | |
| parent | 55df5c80239f8af14836f9bd14f8c7e5c473bea3 (diff) | |
| parent | 24adb1f68cb5ce7fae8cb9a4b01aab728d827fa2 (diff) | |
Rollup merge of #110932 - sameer:master, r=michaelwoerister
include source error for LoadLibraryExW In #107595, we added retry behavior for LoadLibraryExW on Windows. If it fails we do not print the underlying error that Windows returned. This made #110889 a little harder to debug. In this PR I am adding the source error in the message if it is available.
| -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) } |
