Skip to content

Commit ed46c12

Browse files
committed
add llvm_enzyme to libcore
1 parent 170d256 commit ed46c12

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

library/core/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,6 @@ check-cfg = [
3838
'cfg(target_has_reliable_f16_math)',
3939
'cfg(target_has_reliable_f128)',
4040
'cfg(target_has_reliable_f128_math)',
41+
'cfg(llvm_enzyme)',
42+
4143
]

library/core/src/macros/mod.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1511,9 +1511,10 @@ pub(crate) mod builtin {
15111511
/// If used on an input argument, a new shadow argument of the same type will be created,
15121512
/// directly following the original argument.
15131513
///
1514-
/// ### Usage exammples:
1514+
/// ### Usage examples:
15151515
///
1516-
/// ```rust
1516+
#[cfg_attr(llvm_enzyme, doc = " ```rust")]
1517+
#[cfg_attr(not(llvm_enzyme), doc = " ```rust,compile_fail")]
15171518
/// use std::autodiff::*;
15181519
/// #[autodiff_forward(rb_fwd1, Dual, Const, Dual)]
15191520
/// #[autodiff_forward(rb_fwd2, Const, Dual, Dual)]
@@ -1581,9 +1582,10 @@ pub(crate) mod builtin {
15811582
/// `Const` should be used on non-float arguments, or float-based arguments as an optimization
15821583
/// if we are not interested in computing the derivatives with respect to this argument.
15831584
///
1584-
/// ### Usage exammples:
1585+
/// ### Usage examples:
15851586
///
1586-
/// ```rust
1587+
#[cfg_attr(llvm_enzyme, doc = " ```rust")]
1588+
#[cfg_attr(not(llvm_enzyme), doc = " ```rust,compile_fail")]
15871589
/// use std::autodiff::*;
15881590
/// #[autodiff_reverse(rb_rev, Active, Active, Active)]
15891591
/// fn rosenbrock(x: f64, y: f64) -> f64 {

0 commit comments

Comments
 (0)