Skip to content

Commit b58a848

Browse files
committed
Disable autodiff bootstrapping
1 parent fcfcd6b commit b58a848

File tree

3 files changed

+29
-19
lines changed

3 files changed

+29
-19
lines changed

core/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ pub mod assert_matches {
226226

227227
// We don't export this through #[macro_export] for now, to avoid breakage.
228228
#[unstable(feature = "autodiff", issue = "124509")]
229+
#[cfg(not(bootstrap))]
229230
/// Unstable module containing the unstable `autodiff` macro.
230231
pub mod autodiff {
231232
#[unstable(feature = "autodiff", issue = "124509")]

core/src/macros/mod.rs

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1519,33 +1519,39 @@ pub(crate) mod builtin {
15191519
($file:expr $(,)?) => {{ /* compiler built-in */ }};
15201520
}
15211521

1522-
/// Automatic Differentiation macro which allows generating a new function to compute
1523-
/// the derivative of a given function. It may only be applied to a function.
1524-
/// The expected usage syntax is
1525-
/// `#[autodiff(NAME, MODE, INPUT_ACTIVITIES, OUTPUT_ACTIVITY)]`
1526-
/// where:
1527-
/// NAME is a string that represents a valid function name.
1528-
/// MODE is any of Forward, Reverse, ForwardFirst, ReverseFirst.
1529-
/// INPUT_ACTIVITIES consists of one valid activity for each input parameter.
1530-
/// OUTPUT_ACTIVITY must not be set if we implicitly return nothing (or explicitly return
1531-
/// `-> ()`). Otherwise it must be set to one of the allowed activities.
1532-
#[unstable(feature = "autodiff", issue = "124509")]
1533-
#[allow_internal_unstable(rustc_attrs)]
1534-
#[rustc_builtin_macro]
1535-
pub macro autodiff($item:item) {
1536-
/* compiler built-in */
1537-
}
1538-
1522+
/// the derivative of a given function in the forward mode of differentiation.
1523+
/// It may only be applied to a function.
1524+
///
1525+
/// The expected usage syntax is:
1526+
/// `#[autodiff_forward(NAME, INPUT_ACTIVITIES, OUTPUT_ACTIVITY)]`
1527+
///
1528+
/// - `NAME`: A string that represents a valid function name.
1529+
/// - `INPUT_ACTIVITIES`: Specifies one valid activity for each input parameter.
1530+
/// - `OUTPUT_ACTIVITY`: Must not be set if the function implicitly returns nothing
1531+
/// (or explicitly returns `-> ()`). Otherwise, it must be set to one of the allowed activities.
15391532
#[unstable(feature = "autodiff", issue = "124509")]
15401533
#[allow_internal_unstable(rustc_attrs)]
15411534
#[rustc_builtin_macro]
1535+
#[cfg(not(bootstrap))]
15421536
pub macro autodiff_forward($item:item) {
15431537
/* compiler built-in */
15441538
}
15451539

1540+
/// Automatic Differentiation macro which allows generating a new function to compute
1541+
/// the derivative of a given function in the reverse mode of differentiation.
1542+
/// It may only be applied to a function.
1543+
///
1544+
/// The expected usage syntax is:
1545+
/// `#[autodiff_reverse(NAME, INPUT_ACTIVITIES, OUTPUT_ACTIVITY)]`
1546+
///
1547+
/// - `NAME`: A string that represents a valid function name.
1548+
/// - `INPUT_ACTIVITIES`: Specifies one valid activity for each input parameter.
1549+
/// - `OUTPUT_ACTIVITY`: Must not be set if the function implicitly returns nothing
1550+
/// (or explicitly returns `-> ()`). Otherwise, it must be set to one of the allowed activities.
15461551
#[unstable(feature = "autodiff", issue = "124509")]
15471552
#[allow_internal_unstable(rustc_attrs)]
15481553
#[rustc_builtin_macro]
1554+
#[cfg(not(bootstrap))]
15491555
pub macro autodiff_reverse($item:item) {
15501556
/* compiler built-in */
15511557
}

std/src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,12 @@
276276
// tidy-alphabetical-start
277277

278278
// stabilization was reverted after it hit beta
279+
#![cfg_attr(not(bootstrap), feature(autodiff))]
279280
#![feature(alloc_error_handler)]
280281
#![feature(allocator_internals)]
281282
#![feature(allow_internal_unsafe)]
282283
#![feature(allow_internal_unstable)]
283284
#![feature(asm_experimental_arch)]
284-
#![feature(autodiff)]
285285
#![feature(cfg_sanitizer_cfi)]
286286
#![feature(cfg_target_thread_local)]
287287
#![feature(cfi_encoding)]
@@ -636,12 +636,15 @@ pub mod simd {
636636
#[doc(inline)]
637637
pub use crate::std_float::StdFloat;
638638
}
639+
639640
#[unstable(feature = "autodiff", issue = "124509")]
641+
#[cfg(not(bootstrap))]
640642
/// This module provides support for automatic differentiation.
641643
pub mod autodiff {
642644
/// This macro handles automatic differentiation.
643-
pub use core::autodiff::autodiff;
645+
pub use core::autodiff::{autodiff_forward, autodiff_reverse};
644646
}
647+
645648
#[stable(feature = "futures_api", since = "1.36.0")]
646649
pub mod task {
647650
//! Types and Traits for working with asynchronous tasks.

0 commit comments

Comments
 (0)