Skip to content

Commit 2fe37e3

Browse files
pnkfelixgitbot
authored and
gitbot
committed
Separate contract feature gates for the internal machinery
The extended syntax for function signature that includes contract clauses should never be user exposed versus the interface we want to ship externally eventually.
1 parent b404184 commit 2fe37e3

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

core/src/contracts.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub use crate::macros::builtin::contracts_requires as requires;
88
/// Emitted by rustc as a desugaring of `#[requires(PRED)] fn foo(x: X) { ... }`
99
/// into: `fn foo(x: X) { check_requires(|| PRED) ... }`
1010
#[cfg(not(bootstrap))]
11-
#[unstable(feature = "rustc_contracts", issue = "none" /* compiler-team#759 */)]
11+
#[unstable(feature = "rustc_contracts_internals", issue = "133866" /* compiler-team#759 */)]
1212
#[lang = "contract_check_requires"]
1313
#[track_caller]
1414
pub fn check_requires<C: FnOnce() -> bool>(c: C) {
@@ -21,7 +21,7 @@ pub fn check_requires<C: FnOnce() -> bool>(c: C) {
2121
/// into: `fn foo() { let _check = build_check_ensures(|ret| PRED) ... [return _check(R);] ... }`
2222
/// (including the implicit return of the tail expression, if any).
2323
#[cfg(not(bootstrap))]
24-
#[unstable(feature = "rustc_contracts", issue = "none" /* compiler-team#759 */)]
24+
#[unstable(feature = "rustc_contracts_internals", issue = "133866" /* compiler-team#759 */)]
2525
#[lang = "contract_build_check_ensures"]
2626
#[track_caller]
2727
pub fn build_check_ensures<Ret, C>(c: C) -> impl (FnOnce(Ret) -> Ret) + Copy

core/src/intrinsics/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -4071,8 +4071,8 @@ pub const unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize)
40714071
/// checking is turned on, so that we can specify contracts in libstd
40724072
/// and let an end user opt into turning them on.
40734073
#[cfg(not(bootstrap))]
4074-
#[rustc_const_unstable(feature = "rustc_contracts", issue = "none" /* compiler-team#759 */)]
4075-
#[unstable(feature = "rustc_contracts", issue = "none" /* compiler-team#759 */)]
4074+
#[rustc_const_unstable(feature = "rustc_contracts_internals", issue = "133866" /* compiler-team#759 */)]
4075+
#[unstable(feature = "rustc_contracts_internals", issue = "133866" /* compiler-team#759 */)]
40764076
#[inline(always)]
40774077
#[rustc_intrinsic]
40784078
pub const fn contract_checks() -> bool {
@@ -4083,14 +4083,14 @@ pub const fn contract_checks() -> bool {
40834083
}
40844084

40854085
#[cfg(not(bootstrap))]
4086-
#[unstable(feature = "rustc_contracts", issue = "none" /* compiler-team#759 */)]
4086+
#[unstable(feature = "rustc_contracts_internals", issue = "133866" /* compiler-team#759 */)]
40874087
#[rustc_intrinsic]
40884088
pub fn contract_check_requires<C: FnOnce() -> bool>(c: C) -> bool {
40894089
c()
40904090
}
40914091

40924092
#[cfg(not(bootstrap))]
4093-
#[unstable(feature = "rustc_contracts", issue = "none" /* compiler-team#759 */)]
4093+
#[unstable(feature = "rustc_contracts_internals", issue = "133866" /* compiler-team#759 */)]
40944094
#[rustc_intrinsic]
40954095
pub fn contract_check_ensures<'a, Ret, C: FnOnce(&'a Ret) -> bool>(ret: &'a Ret, c: C) -> bool {
40964096
c(ret)

core/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ pub mod autodiff {
249249
}
250250

251251
#[cfg(not(bootstrap))]
252-
#[unstable(feature = "rustc_contracts", issue = "none")]
252+
#[unstable(feature = "rustc_contracts", issue = "133866")]
253253
pub mod contracts;
254254

255255
#[unstable(feature = "cfg_match", issue = "115585")]

core/src/macros/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1783,8 +1783,8 @@ pub(crate) mod builtin {
17831783
/// eventually parsed as a unary closure expression that is
17841784
/// invoked on a reference to the return value.
17851785
#[cfg(not(bootstrap))]
1786-
#[unstable(feature = "rustc_contracts", issue = "none")]
1787-
#[allow_internal_unstable(core_intrinsics)]
1786+
#[unstable(feature = "rustc_contracts", issue = "133866")]
1787+
#[allow_internal_unstable(rustc_contracts_internals)]
17881788
#[rustc_builtin_macro]
17891789
pub macro contracts_ensures($item:item) {
17901790
/* compiler built-in */
@@ -1796,8 +1796,8 @@ pub(crate) mod builtin {
17961796
/// eventually parsed as an boolean expression with access to the
17971797
/// function's formal parameters
17981798
#[cfg(not(bootstrap))]
1799-
#[unstable(feature = "rustc_contracts", issue = "none")]
1800-
#[allow_internal_unstable(core_intrinsics)]
1799+
#[unstable(feature = "rustc_contracts", issue = "133866")]
1800+
#[allow_internal_unstable(rustc_contracts_internals)]
18011801
#[rustc_builtin_macro]
18021802
pub macro contracts_requires($item:item) {
18031803
/* compiler built-in */

0 commit comments

Comments
 (0)