mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
enrich error info when tries to dlopen Enzyme
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
codegen_llvm_autodiff_component_unavailable = failed to load our autodiff backend. Did you install it via rustup?
|
||||
codegen_llvm_autodiff_component_unavailable = failed to load our autodiff backend.
|
||||
.note = load error: {$err}
|
||||
|
||||
codegen_llvm_autodiff_without_enable = using the autodiff feature requires -Z autodiff=Enable
|
||||
codegen_llvm_autodiff_without_lto = using the autodiff feature requires setting `lto="fat"` in your Cargo.toml
|
||||
|
||||
@@ -34,7 +34,10 @@ fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(codegen_llvm_autodiff_component_unavailable)]
|
||||
pub(crate) struct AutoDiffComponentUnavailable;
|
||||
#[note]
|
||||
pub(crate) struct AutoDiffComponentUnavailable {
|
||||
pub err: String,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(codegen_llvm_autodiff_without_lto)]
|
||||
|
||||
@@ -249,8 +249,10 @@ fn init(&self, sess: &Session) {
|
||||
|
||||
use crate::back::lto::enable_autodiff_settings;
|
||||
if sess.opts.unstable_opts.autodiff.contains(&AutoDiff::Enable) {
|
||||
if let Err(_) = llvm::EnzymeWrapper::get_or_init(&sess.opts.sysroot) {
|
||||
sess.dcx().emit_fatal(crate::errors::AutoDiffComponentUnavailable);
|
||||
if let Err(err) = llvm::EnzymeWrapper::get_or_init(&sess.opts.sysroot) {
|
||||
sess.dcx().emit_fatal(crate::errors::AutoDiffComponentUnavailable {
|
||||
err: format!("{err:?}"),
|
||||
});
|
||||
}
|
||||
enable_autodiff_settings(&sess.opts.unstable_opts.autodiff);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user